Statement - switch between enumerated statements.
CASE <DINT expression> OF
<value> :
<statements>
<value> , <value> :
<statements>;
<value> .. <value> :
<statements>;
ELSE
<statements>
END_CASE;
All enumerated values correspond to the evaluation of the DINT expression and are possible cases in the execution of the statements. The statements specified after the ELSE keyword are executed if the expression takes a value that is not enumerated in the switch. For each case, you must specify either a value, or a list of possible values separated by comas (",") or a range of values specified by a "min .. max" interval. You must enter space characters before and after the ".." separator.
(* this example check first prime numbers
*)
CASE iNumber OF
0 :
Alarm := TRUE;
AlarmText := '0 gives no result';
1 .. 3, 5 :
bPrime := TRUE;
4, 6 :
bPrime := FALSE;
ELSE
Alarm := TRUE;
AlarmText := 'I don't know after 6 !';
END_CASE;
Not available
Not available
Not available