If/then statements conditionally execute a group of commands, depending on the value of an expression.

 

Syntax

 

IF condition THEN statement [ELSE else statement]

 

Alternatively, you can use the multi-line syntax:

 

IF condition THEN

   statements

ELSE

   else statements

ENDIF

 

condition                                 Any expression that evaluates to TRUE  or FALSE

 

statement,                                Statement(s) executed IF condition  is TRUE .  

 

else statements                        Statement(s) executed IF condition  is FALSE .  

 

 

When executing the IF statement, condition is tested. If condition  is TRUE , the statements following THEN  are executed. If condition  is FALSE , the statements following ELSE are executed. After executing the statements following THEN  or ELSE, execution continues with the statement following ENDIF.

 

 

Examples

 

IF ( a = 0 ) THEN print "OK"

 

 

IF ( a = 0 ) or ( b = 0 ) THEN c = ( c - 1 ) ELSE c = ( c + 1 )

 

 

IF  ( a = 0 ) THEN

    ( b = 0 )

    ( c = 0 )

ELSE

    ( b = 1 )

    ( c = 1 )

ENDIF

 

You can nest IF  statements by placing one IF  within another:

 

IF  ( a = 0 ) THEN

  IF ( b = 0 ) THEN

      ( c = 0 )

  ELSE

      ( c = 1 )

  ENDIF

ENDIF

 

 

 

Syntax:

 

 

Parameter:

Description:

 


 

Example:

 

Returns:

 

 

Links:

 

See Also:

 

 


Edit Time: 9/25/2017 09:09:58 AM


Topic ID#: 376

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software