MC-Basic:IF ... THEN ... ELSE
This decision construct enables one section of code or another to be executed, depending on the state of a specified condition. A condition is an expression that, when evaluated, is TRUE if the result is not zero, and FALSE if the result is zero. The ELSE section is optional, but must be followed by at least one statement. IF statements may be nested within each other. There is no ELSE IF command. If you you an IF after ELSE, you must place IF on a new line.
Syntax
IF <condition> THEN
<first statement to execute if condition is true>
<multiple statements to execute if condition is true>
{ELSE
<first statement to execute if condition is false>
<multiple statements to execute if condition is false>}
END IF
Availability
All versions
Scope
Task , Config
Limitations
Do not use IF…THEN…ELSE in Config.prg.
Examples
IF SYSTEM.din.1 = 0 Then ‘check input #1
Jog x_axis 100
Else
Jog x_axis 200
End If