Learn Script ST - aliconnect/aliconnect.sdk GitHub Wiki
PROGRAM stexample
VAR
x : BOOL;
END_VAR
x := TRUE;
REPEAT
x := FALSE;
UNTIL x := FALSE;
END_REPEAT;
END_PROGRAM;
IF <condition(s)> THEN
<code>
ELSIF <condition(s)> THEN
<code>
ELSE
<code>
END_IF
Select one of several alternative program sections. ELSE are optional.
CASE <var> OF
<int>:
<code>
<int>:
<code>
ELSE
<code>
END_CASE
Repeat a sequence of statements as long as a control variable is within the specified range of values
FOR <var> := <int> TO <int> BY <step> DO
<code>
END_FOR
Repeat a sequence of statements until condition(S) is true. Note minimum one execution.
REPEAT
<code>
UNTIL <condition(S)>
END_REPEAT
Repeat a sequence of statements as long as condition(S) is true.
WHILE <condition(s)> DO
<code>
END_WHILE
Terminates the FOR, WHILE or REPEAT loop in which it resides without regard to any condition
EXIT
Terminates Program, Function block call
RETURN
IF condition THEN
Statement;
..
Statement;
[ ELSEIF condition THEN
Statement;
..
Statement; ]
[ ELSE
Statement;
..
Statement; ]
END_IF;
CASE selector OF
label[,label]:
statement;
label:
statement;
label:
statement;
ELSE
statement;
END_CASE;