Case Statement - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

8.2.5

CASE Statement

The CASE .... OF construct offers conditional execution of statement lists. It uses the value of an ST
integer expression to determine whether to execute a statement list. The statement list to be
executed can be selected from multiple statement lists, depending on the value of the associated
integer expression.
Conditions can be expressed as a single value, a list of values, or a range of values. The single-value,
list of values, or range forms can be used by themselves or in combination. The optional ELSE
keyword can be used to execute a statement list when the associated value does not meet any of
the specified conditions.
You can have a maximum of 1024 cases in a single CASE ... OF construct. Additional cases can be
handled by adding the ELSE keyword to the construct and specifying a nested CASE ... OF construct
or an IF ... THEN construct after the ELSE.
The number of nested CASE ... OF constructs and the number of levels are limited by the memory in
your computer.
The number of constants and constant ranges in a single conditional statement is limited by the
memory in your computer.
Format
CASE Integer_Expression OF
Int1:
StatementList_1;
Int2,Int3,Int4:
StatementList_2;
Int5..Int6:
StatementList_3;
[ELSE
StatementList_Else;]
END_CASE;
Where:
Integer_Expression
Int
StatementList_1 ...
StatementList_n
Operation
The Int values are compared to Integer_Expression. The statement list following the first Int value
that matches Integer_Expression is executed. If the optional ELSE keyword is used and no Int value
matches Integer_Expression, the statement list following ELSE is executed. Otherwise, no statement
list is executed.
Requirements for Conditional Statements
All constants must be of type INT, DINT or UINT.
In range declarations, the beginning value must be less than the ending value (reading from left
to right). For example, 10..3 and 5..5 are invalid.
Overlapping values in different case conditions are not allowed. For example, 5..10 and 7 cannot
be specified as conditions in the same CASE ... OF construct.
GFK-2950C
Chapter 8. Structured Text (ST) Programming
(*Single Value*)
(*List of Values*)
(*Range of Values*)
(*Optional*)
An ST expression that resolves to an integer (INT, DINT or UINT)
value.
A constant integer value.
Structured Text statements.
February 2018
375

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents