Difference between revisions of "IF"

From Recital Documentation Wiki
Jump to: navigation, search
 
(Products)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=IF=
 
 
 
==Class==
 
Applications
 
 
 
 
==Purpose==
 
==Purpose==
 
Conditional command execution
 
Conditional command execution
Line 21: Line 14:
  
 
==See Also==
 
==See Also==
DO CASE, DO WHILE, IIF()
+
[[DO CASE]], [[DO WHILE]], [[IIF()]]
  
  
Line 39: Line 32:
 
seek "BALLET"
 
seek "BALLET"
 
if found()
 
if found()
edit
+
    edit
 
else
 
else
dialog message "Record not found."
+
    dialog message "Record not found."
 
endif
 
endif
 
</code>
 
</code>
Line 47: Line 40:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Applications]]
 +
[[Category:Applications Commands]]
 +
[[Category:Looping Commands]]

Latest revision as of 09:40, 30 November 2009

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