Case Select - Omron CX-Supervisor Reference Manual

Script language reference
Hide thumbs Also See for CX-Supervisor:
Table of Contents

Advertisement

Control Statements
4-3-3

Case Select

SECTION 4 CX-Supervisor Script Language
Refer to chapter 4, Punctuation for details of the use of indentation.
Syntax
SELECT CASE expression
CASE expression
statementblock1
CASE expression
statementblock2
CASE expression
statementblock3
END SELECT
or
SELECT CASE expression
CASE expression
statementblock1
CASE expression
statementblock2
CASE ELSE
statementblock3
END SELECT
Remarks
Argument
Description
expression
The expression may be a point, or a calculation of
constants and/or points that produces a result.
statementblock1
One or more statements that are only performed if the
preceding CASE expression is met.
statementblock2
One or more statements that are only performed if the
preceding CASE expression is met.
statementblock3
One or more statements that are only performed if the
preceding CASE expression is met.
Typical Examples
SELECT CASE colourvalue
CASE 1
colour (blue)
CASE 2
colour (green)
CASE 3
colour (cyan)
CASE ELSE
colour (0)
END SELECT
This example shows the assignment of a colour according to the value of a
point. The value of Integer point 'colourvalue' is evaluated and compared with
each case until a match is found. When a match is found, the sequence of
actions associated with the CASE statement is performed. When 'colourvalue'
is 1, the colour given to the current object is blue, when 'colourvalue' is 2, the
colour given to the current object is green, when 'colourvalue' is 3, the colour
given to the current object is cyan. If 'colourvalue' falls outside the integer
range 1-3, then the colour given is 0 (black). Like ELSE and ELSEIF, the
CASE ELSE statement is optional.
27

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 3.1

Table of Contents