B&R – PLC – Structured Text – CASE Statement

Syntax

CASE <expression> OF

<value1> : <statement_list1>

<value2>, <value3> : <statement_list2>

<value4>..<value5> : <statement_list3>

ELSE <statement_list4>
END_CASE;


Example

CASE Var1 OF

1, 5: Var2 := 10;

2: Var2 := 20;

6..9: Var2 := 30;

ELSE Var2 := 40;

END_CASE;