|
floor(x) |
|
x = Any number.
This function rounds down (as in 'down to the floor') the number to the nearest whole number, so wholenumber in Example #1 would return 10. This function is particularly useful when checking for random numbers, because random(x) can return a real number (5.65, 10.3,etc), you can use floor to round the number to a whole number.
Example #1:
Example #2:
(See the switch statement for further details on switch).
Revision #1 |