pxt-calliope/docs/reference/math.md

333 B

Math

Numeric values: 0, 1, 2, ...

0;
1;
2;

Arithmetic binary operation (+, -, *, /)

0+1;
0-1;
1*2;
3/4;

Absolute value

Math.abs(-5);

Minimum/maximum of two values

Math.min(0, 1);
Math.max(0, 1);

Random value

Math.random(5);