Using the else keyword

The else keyword can be used to handle the result of an if statement in the event that the expression turns out to be false. This is a useful construct as it means you don't need to check for every single condition. You may simply want to know whether a variable has a certain value, and if so handle that situation, otherwise do something differently.

score as integer = 1

do if score = 0 print ( "the score is 0" ) else print ( "the score is not 0" ) endif
sync ( ) loop

In this instance as the variable score has been assigned a value of 1, when the if statement is checked its condition is false, so the block of code in the else section is executed, displaying "the score is not 0" on screen. If score had a value of 0 then the condition for the if statement would be met, so "the score is 0" would be printed out on screen.