Operators
JSLogo supports the standard math operators: +, -, /, *, % (modulus).
print 4 + 5
>9
Comparisons
JSLogo can compare values using =, <, >, <= and >=, returning true or false depending on the resolution.
Math Functions
Name | Arguments | Description |
---|---|---|
remainder | numerator denominator (two numbers) | Returns the remainder following the division operation |
round | number | Returns rounded integer; alias int |
int | number | Returns the integer part of a decimal number. Alias floor. |
ceil | number | Returns the nearest integer greater or equal to the number. |
minus | number | Returns the provided number with the opposite sign |
sin | number | Returns sin(number) |
cos | number | Returns cos(number) |
tan | number | Returns tan(number) |
sqrt | number | Returns the square root of the number |
sum | number number | Returns sum of the two arguments |
difference | number number | Returns the difference of the two arguments |
quotiant | numerator denominator | Returns the quotiant of the two argument |
ln | number | Returns the natural log of the argument, ln(number) |
power | number number | Returns the first argument raised to the power of the second argument |
random | number or array of two numbers | Returns a random number from 0 to the argument or, when providing an array, between the first two members of the array |
abs | number | Returns the absolute value of the argument |
Last updated on December 21, 2022