The ST language commands are ending by a semicolon. The EOL character is treated in the same way as the space character.
Command | Description | Example |
---|---|---|
:= | Assignment. The value calculated on the right is assigned to the identifier on the left. |
A:=B; C:=SIN(X); My_FB(p1:=10, p2:=20); |
=> | Assignment. Value of the variable declared on the left is assigned to the identifier on the right. |
FB1( out1 => my_var ); |
REF= | Reference. Variable on the left is filled with reference to the value on the right. |
MyVar:= 100; MyRef REF= MyVar; MyRef:= 200; |
IF | Selection command. If the BOOLean condition is met the associated command is executed. |
IF A>10 THEN B:=1; |
CASE | Selection command. Execution of a block of commands if the CASE condition is met. |
CASE TW OF |
FOR | Iterative command. A loop of block of commands with an initial value, end condition, and increment value. |
FOR I:= 0 TO 10 BY 2 |
WHILE | Iterative command. A loop of block of commands with condition for exiting the loop at the beginning. |
WHILE J>10 DO |
REPEAT | Iterative command. A loop of block of commands with condition for exiting the loop at the end. |
REPEAT |
EXIT | Exiting the loop. Premature exiting of the command loop. |
EXIT; |
RETURN | Return. Leaving of the currently executed block. |
RETURN; |