else
Purpose
Conditionally execute a block of code when the condition is false
Description
Used to execute a block of code if the condition in the if statement is not met
Syntax
if condition then ... else ... endIf // if condition is met execute first ... otherwise execute second ...
Arguments
condition condition to be tested. This can be a compound condition using AND and OR
Example
limit = 5
y = 0
for i = 0 to 11 loop
if i < limit then
printAt( 0, y, "Number: ", i, " is less than ", limit )
else
if i == limit then
printAt( 0, y, "Number: ", i, " is equal to ", limit )
else
printAt( 0, y, "Number: ", i, " is more than ", limit )
endif
endif
repeat
update()
sleep( 5 )
Associated Commands