Difference between revisions of "IF"

From Recital Documentation Wiki
Jump to: navigation, search
Line 47: Line 47:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Applications]]
 +
[[Category:Applications Commands]]

Revision as of 13:36, 4 June 2009

Class

Applications


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 Database Server, Recital Mirage Server, Recital Terminal Developer