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


Syntax:     IF <condition>
               <statements>...
            [ELSEIF <condition>]
               <statements>...
            [ELSE]
               <statements>...
            ENDIF

Purpose:    To select a path of program execution depending on one or
            more conditions.

Argument:   <condition> is a control expression.  If it evaluates to
            true (.T.), all following commands are executed until an
            ELSEIF, ELSE, or ENDIF is encountered.

Options:    Elseif: The ELSEIF clause identifies statements to
            execute if the specified <condition> evaluates to true (.T.)
            and any 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: The ELSE clause identifies commands to execute if
            the IF and any ELSEIF conditions evaluate to false (.F.).

Usage:      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.

            Note that IF...ENDIF structures may be nested within other
            IF...ENDIF structures and other structured programming
            commands.  These structures, however, must be properly
            nested.

            Note also that like all Clipper control structures, only the
            first three characters of the END statement are
            significant.  END is also a reserved word and should not be
            used when naming memory variables.

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   number = 0

   IF number < 50
      ? "Less than 50"
   ELSEIF number = 50
      ? "Is equal to 50"
   ELSE
      ? "Greater than 50"
   ENDIF


See Also: DO CASE IF()

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