IF

From Recital Documentation Wiki
Revision as of 09:40, 30 November 2009 by Barrymavin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Conditional command execution


Syntax

IF <condition>

[ELSEIF<condition>]

[ELSE]

ENDIF


See Also

DO CASE, DO WHILE, IIF()


Description

The IF command provides a conditional selection of commands to execute based upon a logical <condition>. If the result of the <condition> is .T., then the commands following the IF, up to an ENDIF statement or an ELSE statement are executed. IF statements may be nested, i.e. IF statements may contain other IF statements, provided that the ELSE and ENDIF statements correspond with a valid IF.

ELSEIF

The ELSEIF clause can be added to the IF control structure allowing for the testing of more than one condition in the IF...ENDIF block. The IF block is now essentially the same as the DO CASE structure. ELSEIF is analogous with the CASE statement.

ELSE

The ELSE statement is analogous with the OTHERWISE statement. If no previous IF <condition> or ELSEIF <condition> is true, the commands following the ELSE statement up to the ENDIF statement are executed.


Example

use patrons index events, names
seek "BALLET"
if found()
    edit
else
    dialog message "Record not found."
endif


Products

Recital Server, Recital