Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>if</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 IF
 Execute one of several alternative blocks of statements
------------------------------------------------------------------------------
 Syntax

     IF <lCondition1>
        <statements>...
     [ELSEIF <lCondition2>]
        <statements>...
     [ELSE]
        <statements>...
     END[IF]

 Arguments

     <lCondition> is a logical control expression.  If it evaluates to
     true (.T.), all following statements are executed until an ELSEIF, ELSE,
     or ENDIF is encountered.

     ELSEIF <lCondition> identifies statements to execute if the
     associated condition evaluates to true (.T.) and all preceding IF or
     ELSEIF conditions evaluate to false (.F.).  Any number of ELSEIF
     statements can be specified within the same IF...ENDIF control
     structure.

     ELSE identifies statements to execute if the IF and all preceding
     ELSEIF conditions evaluate to false (.F.).

 Description

     The IF control structure works by branching execution to statements
     following the first true (.T.) evaluation of the IF or any ELSEIF
     condition.  Execution then continues until the next ELSEIF, ELSE, or
     ENDIF is encountered whereupon execution branches to the first statement
     following the ENDIF.

     If no condition evaluates to true (.T.), control passes to the first
     statement following the ELSE statement.  If an ELSE statement is not
     specified, control branches to the first statement following the ENDIF
     statement.

     IF...ENDIF structures may be nested within IF...ENDIF structures and
     other control structure commands.  These structures, however, must be
     nested properly.

     The IF...ELSEIF...ENDIF form of the IF construct is identical to DO
     CASE...ENDCASE.  There is no specific advantage of one syntax over the
     other.  The IF construct is also similar to the IF() function which can
     be used within expressions.

 Examples

     .  This example evaluates a number of conditions using an
        IF...ELSEIF...ENDIF construct:

        LOCAL nNumber := 0
        //
        IF nNumber < 50
           ? "Less than 50"
        ELSEIF nNumber = 50
           ? "Is equal to 50"
        ELSE
           ? "Greater than 50"
        ENDIF


See Also: BEGIN SEQUENCE DO CASE DO WHILE FOR IF()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson