IF ... THEN |
IF Condition [THEN | GOTO] [Label | EXIT]
Function
Evaluate Condition and, if it is true, jump to the point in the
program designated by Label.
Explanation
IF...THEN is decision maker that affects program flow. It tests a
Condition statement and, if that statement is True, goes to a point
in the program specified by Label. The available comparison operators
are:
Comparison Operator | Definition |
= | Equal |
<> | Not Equal |
> | Greater Than |
< | Less Than |
>= | Greater Than or Equal To |
<= | Less Than or Equal To |
Comparisons are always written in the form: Variable Op Value.
Main: IF StartBtn = 1 THEN Main ' wait for input to go low Check_Mode: IF ModePin = 0 GOTO Show_AMPM ' use HH:MM xM format if mode = 0
Some programmers may prefer a more verbose style; the following syntax is also supported:
Check_Mode: IF ModePin = 0 THEN GOTO Show_AMPM ' use HH:MM xM format if mode = 0
Related instructions: IF ... THEN ... ELSE, BRANCH, GOTO, and EXIT