Error getting tags :
error 404Error getting tags :
error 404 if | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
if
Basics
Expander triangle
Type
Control Structure
Syntax
if condition then statement [else elseStatement]
Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Executes a list of statements if a condition is true.
Examples

Additional Comments
Expander triangle

Use the if control structure to execute a statement (or list of statements) only under certain circumstances.

Form:

The if control structure always begins with the word if. There are four forms of the if control structure:

if condition then statement [else elseStatement]

(This form may have a line break before the words then or else or both.)

if condition then

statementList

[else

elseStatementList]

end if

if condition

then statement

[else

elseStatementList

end if]

if condition then

statementList

else elseStatement

Parameters:

The condition is any expression that evaluates to true or false.

The statementList or elseStatementList consists of one or more Revolution statements, and can also include if, switch, try, or repeat control structures. The statement or elseStatement consists of a single Revolution statement.

Comments:

If the condition evaluates to true, the statement or statementList is executed; if the condition evaluates to false, the statement or statementList is skipped.

If the if control structure contains an else clause, the elseStatement or elseStatementList is executed if the condition is false.

If one if control structure is nested inside another, use of the second form described above is recommended, since the other forms may cause ambiguities in interpreting which else clause belongs with which if statement.

The if control structure is most suitable when you want to check a single condition. If you need to check for multiple possibilities, doing something different for each one, use a switch control structure instead.

Note: The ifcontrol structure is implemented internally as a command and appears in the commandNames.

User Comments
Expander triangle