pxt-calliope/docs/reference/math/math.md
2016-03-25 16:47:20 -07:00

1.5 KiB

Math Library

Functions in the math library. #docs #math #random #abs #mod #pow #max #min #clamp

@parent blocks/language

The math library includes math related functions that you can use with Numbers.

  • In the Block editor, click maths on the left to see the available blocks

The functions available in Block Editor are:

abs

math -> abs (x : Number) returns Number

returns the absolute value of input parameter x

max

math -> max (x : Number, y : Number) returns Number

returns the larger of two input numbers (x and y)

min

math -> min (x : Number, y : Number) returns Number

returns the smaller of two input numbers (x and y)

random

math -> random (limit : Number) returns Number

returns a random Number between 0 and the parameter limit

Lessons

love meter

See also

Block Editor documentation, Number