Overview | Statement List | Example 1 | Example 2 | Example 3 | Example 4


¿éIF

Synopsis

 IFTHEN/e1
block1
[ELSEIF/e2
block2]
.
.
.
[ELSE
block3]
ENDIF

Description

The BLOCKIF statements allow you to conditionally execute blocks (or groups) of GRIP statements. The four BLOCKIF statements are:

NOTE: All of the BLOCKIF statements create labels internally that contribute to the total count of labels. The IFTHEN/ELSE/ELSEIF/ENDIF uses 2 labels plus 1 for every ELSEIF.

These statements are used in BLOCKIF constructs. A block is a sequence of zero or more complete GRIP statements. Each sequence is called a statement block.

Each BLOCKIF statement, except the ENDIF statement, has an associated statement block. The statement block consists of all the statements following the BLOCKIF statement up to (but not including) the next BLOCKIF statement in the BLOCKIF construct. The statement block is conditionally executed based on the value(s) of the logical expression(s) in the preceding BLOCKIF statements.

The IFTHEN statement begins a BLOCKIF construct. The block following it is executed if the value of the logical expression in the IFTHEN statement is true.

The ELSEIF statement is an optional statement that specifies a statement block to be executed if no preceding statement block in the BLOCKIF construct has been executed, and if the value of the logical expression in the ELSEIF statement is true.

The ELSE statement specifies a statement block to be executed if no preceding statement block in the BLOCKIF construct has been executed. The ELSE statement is optional. However, if the ELSE statement is present, its statement block must be immediately followed by the ENDIF statement.

The ENDIF statement terminates the BLOCKIF construct.

Parameters

Parameter

Description

IFTHEN

The BLOCKIF statement which begins the construct. It evaluates the logical expression passed to it. If the expression is true, it executes the accompanying block. Up to 32 levels of IFTHEN statements can be nested per block as shown in Figure 1-11.

Levels of IFTHEN statements per block

e1

The logical expression passed to the IFTHEN statement.

block1

A set of GRIP statements which are executed if the preceding e1 expression is true.

ELSEIF

An optional BLOCKIF statement that specifies a statement block to be executed if no preceding statement block of the BLOCKIF construct has been executed, and if the value of the logical expression in the ELSEIF statement is true. Each IFTHEN construct can contain up to 36 ELSEIF statements.

e2

The logical expression passed to the ELSEIF statement.

block2

A set of GRIP statements which are executed if the preceding e2 expression is true.

ELSE

An optional BLOCKIF statement which is executed if no previous statement block in the BLOCKIF construct has been executed.

block3

A set of GRIP statements which the system executes if no previous statement block in the BLOCKIF construct has been executed.

ENDIF

The BLOCKIF statement which terminates the construct.


Copyright ©2015 ºú¾ýNX¶þ´Î¿ª·¢¹ÙÍø£¨www.UGapi.com£© QQ:85585969 All Rights Reserved.