Silverfrost Logo About Us | Contact Us
 

IF construct

A simple form for the IF construct is:

 IF(logical_expression) THEN

  statement_block 1

 [ELSE

  statement_block 2 ]

 ENDIF

The ELSE section is optional. If the logical expression is true, the first block is executed, otherwise the second.

For example:

IF(x>0.0)THEN

 y=x

ELSE

 y=0.0

ENDIF

Logical expressions are formed using relational operators and logical operators knowing their order of precedence.

Logical expressions can be stored as mLOGICAL variables.

If the ELSE section consists of one IF construct, then ELSE and IF can be reduced to ELSEIF provided that one of the associated ENDIFs is deleted. Sometimes it is simpler to use a CASE construct.

IF constructs can be named. Optionally, the same name may be used after ELSE and after ELSEIF (expr) THEN.

 

 

Copyright © 1999-2017 Silverfrost Limited