49 lines
1.3 KiB
Markdown
49 lines
1.3 KiB
Markdown
# Math Library
|
|
|
|
Functions in the math library.
|
|
|
|
### @parent blocks/language
|
|
|
|
The math library includes math related functions that you can use with [Numbers](/reference/types/number).
|
|
|
|
* In the [Block editor](/blocks/editor), click **maths** on the left to see the available blocks
|
|
|
|
The functions available in Block Editor are:
|
|
|
|
### abs
|
|
|
|
math `->` abs (x : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
|
|
|
returns the absolute value of input parameter `x`
|
|
|
|
![](/static/mb/blocks/math-0.png)
|
|
|
|
### max
|
|
|
|
math `->` max (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
|
|
|
returns the larger of two input numbers (`x` and `y`)
|
|
|
|
![](/static/mb/blocks/math-1.png)
|
|
|
|
### min
|
|
|
|
math `->` min (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
|
|
|
returns the smaller of two input numbers (`x` and `y`)
|
|
|
|
![](/static/mb/blocks/math-2.png)
|
|
|
|
### random
|
|
|
|
math `->` random (limit : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
|
|
|
returns a random [Number](/reference/types/number) between 0 and the parameter *limit*
|
|
|
|
![](/static/mb/blocks/math-3.png)
|
|
|
|
### See also
|
|
|
|
[Block Editor documentation](/blocks/contents), [Number](/reference/types/number)
|
|
|