Used to conditionally execute a block of statements when expression evaluates to true and another block of statements when the expression is false.
Syntax
if expression then
{ statement }...
else
{ statement }...
end
Notes
expression
|
the expression to evaluate.
|
statement
|
any statements to process.
|
Example
if quantity < 1 then
unitCost = totalAmount / quantity
print( "Unit Cost: " + unitCost )
else
print( quantity + "is not valid value" )
end
|