Talk:TI-Basic Z80 Programming/List of Commands/If

Correction
I took out this section because it didn't work on my TI-83

When using If to regulate the execution of more than one instruction, it is important to indicate the end of the set of instructions with an End. Without the End, only the instruction immediately follwing the If statement will be reguated while the rest will be executed indifferent to the value of the criteria.

For example:

[...]
 * If X>3
 * Disp "Hello World!"
 * Disp "My Name is Seth"

[...]

will display "Hello World!" followed by "My name is Seth" if X (the user's input) is greater than 3, and will display only "My name is Seth" if X is less than 3. This is beacsue :Disp "My Name is Seth" is executed regardless what the value of X is. Meanwhile,

[...]
 * If X>3
 * Disp "Hello World!"
 * Disp "My Name is Seth"
 * End

[...]

will display "Hello World!" followed by "My name is Seth" if X is greater than 3 and will display nothing if X is less than 3. This is because the execution of all the intructions between If and End is regulated by the criteria stated after If.