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

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 8. Structured Text (ST) Programming
8.2.4

IF Statement

The IF construct offers conditional execution of a statement list. The condition is determined by
result of a Boolean expression. The IF construct includes two optional parts, ELSE and ELSIF, that
provide conditional execution of alternate statement list(s). One ELSE and any number of ELSIF
sections are allowed per IF construct.
Format
IF BooleanExpression1 THEN
StatementList1;
[ELSIF BooleanExpression2 THEN (*Optional*)
StatementList2;]
[ELSE
StatementList3;]
END_IF;
Where:
BooleanExpression
StatementList Any set of structured text statements.
Note: Either ELSIF or ELSEIF can be used for the else if clause in an IF statement.
Operation
The following sequence of evaluation occurs if both optional parts are present:
If BooleanExpression1 is TRUE (1), StatementList1 is executed. Program execution continues
with the statement following the END_IF keyword.
If BooleanExpression1 is FALSE (0) and BooleanExpression2 is TRUE (1), StatmentList2 is
executed. Program execution continues with the statement following the END_IF keyword.
If both Boolean expressions are FALSE (0), StatmentList3 is executed. Program execution
continues with the statement following the END_IF keyword.
If an optional part is not present, program execution continues with the statement following the
END_IF keyword.
Example
The following code fragment puts text into the variable Status, depending on the value of I/O point
input value.
IF Input01 < 10.0 THEN
Status := Low_Limit_Warning;
ELSIF Input02 > 90.0 THEN
Status := Upper_Limit_Warning;
ELSE
Status := Limits_OK;
END_IF;
374
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
(*Optional*)
Any expression that resolves to a Boolean value.
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents