ceil()
Purpose
Returns the ceiling of a real number
Description
Returns the least integer greater than or equal to the real number specified e.g. ceil(2.4) = 3
Syntax
result = ceil( number )
Arguments
number A real number
result The ceiling of number
Example
roll = 0
clear()
image = loadImage( "Colin Brown/Dice", false )
size = tileSize( image, 0 )
for i = 1 to 10 loop
clear()
roll = random( 6 ) + 1
x = size.x - ( size.x * ( roll % 2 ) )
y = size.y * ( ceil( roll / 2 ) - 1)
drawImage( image, { x, y, size.x, size.y }, { 0, 0, size.x, size.y } )
update()
sleep( 0.3 )
repeat
printAt( 0, 15, "You rolled a ", roll )
update()
sleep( 3 )
Associated Commands