-
-
Notifications
You must be signed in to change notification settings - Fork 2
If and Else
If
statements checks the condition code given to them, if the condition evaluates to false (0), the code inside the If
statement does not execute, otherwise, the code executes. If the statement has an Else
token before the End
token, the code inside the Else
statement will be executed. The difference here in ICE is that ICE does not have a Then
token. To make a comparison to TI-BASIC, this means that all If
's in ICE 'automatically' have a Then
after them, meaning that all If
statements in ICE must be paired with an End
token. Example:
rand→A
ClrHome
If A>6400
Disp "A IS GREATER THAN 6400"
Else
Disp "A IS <= 6400"
End
The example generates a random number and stores it into A
, then checks if A
is greater than 6400. If A
is greater than 6400, the code inside the If-Else block will be executed, meaning a string is displayed to the screen. If A
is not greater than 6400 (if it's equal to or less than 6400), the code inside the Else-End block will be executed, displaying "A IS <= 6400"
to the screen.
ICE Compiler | Peter Tillema
- Introduction
- Building your first program
- Math and numbers
- Variables
- Standard system commands
- Program flow control
- Pointers
- Graphics
- Sprites
- Tilemaps
- Useful routines