Statement: Condition, Type: Continuation
Else
Format: condition-statement Else
begin-identifier
end-identifier
where
-
condition-statement = any valid combined or individual condition statements
-
begin-identifier = the begin keyword identifier to denote the beginning of a condition block
-
end-identifier = the end keyword identifier to denote the end of a condition block.
Description
The Else identifier is used when the outcome of the combined or individual condition statement is evaluated as false. The system will create a block for the Else identifier containing any action and condition statements within the begin and end identifiers. If the condition-statement is evaluated as false, the program will pass control to the body of the Else block and execute any statements that are inside the block.
Example
We want to place bets on the roulette layout Black. Every time we lose a bet, we increase the bet by 1 unit and if we win the bet, we reset back to 1 unit. The following example will perform this task.
RX Script | Copy Code |
---|---|
If Black has lost each time //if Black loses its bet, the outcome is true begin Add 1 unit to Black end Else //Black must have won the bet begin Put 1 unit on Black end |