Basic instructions
8.8 Program control operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
319
The CASE statement is executed according to the following rules:
● The Test_value expression must return a value of the type Int.
● When a CASE statement is processed, the program checks whether the value of the
Test_value expression is contained within a specified list of values. If a match is found,
the statement component assigned to the list is executed.
● If no match is found, the program section following ELSE is executed or no statement is
executed if the ELSE branch does not exist.
Example: Nested CASE statements
CASE statements can be nested. Each nested case statement must have an associated
END_CASE statement.
1 : #var2 := 'A';
65..90: #var2 := 'UpperCase';
97..122: #var2 := 'LowerCase';
ELSE
#var2:= 'SpecialCharacter';