Lesson 5: If, Then, and End
by Anthony Bush
Basically, 'If' tests a condition and if it is true the program will run the next line in the program; if it is false, the program will skip the next line and continue from there. An example:
:If condition
:command
If you want the program to run more than just the next line you will need to add 'Then' and 'End'. Like this:
:If condition
:Then
:command
:command
...
:End
Very simple. Here it is in a program:
:ClrHome
:Disp "HOW ARE YOU?","1=GOOD","2=HORRIBLE"
:Input A
:If A=1
:Disp "THAT'S GOOD TO","HEAR!"
:If A=2
:Disp "I'M SORRY TO","HEAR THAT."
Summary:
Learned when 'Then' and 'End' are and are not needed.
Previous Lesson | Home