Control Statements; Simple Conditional Statements - Omron CX-Supervisor Reference Manual

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

Advertisement

Control Statements

4-3
Control Statements
4-3-1

Simple Conditional Statements

24
The point 'fuel' is assigned the value 0 on the condition that currently, 'fuel' is
less than 0. If 'fuel' is not less than 0, then it is not assigned the new value.
References
Refer to chapter 4, Control Statements for details of the use of the IF THEN
ELSE/ELSEIF ENDIF statements.
Syntax
IF condition THEN
statementblock1
ENDIF
or
IF condition THEN
statementblock1
ELSE
statementblock2
ENDIF
Remarks
Argument
Description
Condition
The condition is made up of points and constants, using
relational, logical or arithmetical notation as a test. The
condition can evaluate Boolean state 'TRUE' and
'FALSE', Integer or Real numbers, or a text string.
Statementblock1
One or more statements which are performed if the
condition is met.
Statementblock2
One or more statements which are performed if the
condition is not met.
Typical Examples
IF fuel < 0 THEN
fuel = 0
ENDIF
Provided Integer point 'fuel' is less than 0, then it is assigned the value 0.
IF burner THEN
fuel = fuel - rate
ENDIF
Provided Boolean point 'burner' is ''TRUE'', then Integer point 'fuel' is assigned
a new value. It is also possible to apply 'IF burner == TRUE THEN' as the first
line, with identical results.
IF distance > 630 AND distance < 660 AND lift >= -3
THEN
winner = TRUE
burner = FALSE
ENDIF
Provided that Integer point 'distance' is greater in value than 630 AND
'distance' is less in value than 660 (i.e. 'distance' is a value between 630 and
660) AND point 'lift' is greater than or equal to -3, then Boolean points 'winner'
and 'burner' are assigned new values.
SECTION 4 CX-Supervisor Script Language

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 3.1

Table of Contents