IfThen

Description:              Conditionally Execute Statements. This statement executes a statement if the condition parameter is true.

Returns:                    Nothing

Usage:                       Script

Format:                      IfThen(Condition, Expression1, Expression2, ...)

Parameters:             Condition     { Boolean }  { required }  { no default }

                                                An expression that will indicate whether or not the Expression parameters are executed. If this is true, the Expression parameters will be executed.

                                    Expression1, Expression2, ...     { expression }  { required }  { no default }

                                                Any statements to be executed when Condition is true. Any number of Expression parameters may be listed. They are executed once in the order that they are listed.

Comments:               This statement may only appear in a script.

Example:

If 1 Main;

[

  IfThen(Valid(tankPtr) && fluidLevel > 1000, 

    startPump = 1, 

    activeTankNum++, 

    msg = "Changing tanks...");  

]

The statement in the script will test to see if tankPtr exists (is valid) and if fluidLevel > 1000, if these conditions are both true, the series of actions will be taken. VTS does not use short-circuit evaluation. Both parts of the condition will always be checked (and evaluated if required).

See Also:

?: | Cond | IfElse