NIPO ODIN Version 5.17

*IF (condition) ... *ELSE

Purpose

Creates a condition.

Syntax

*IF <[expression]> <action> [*ELSE <action>]

Description

The expression will be interpreted and tested for true or false. If the expression is true the commands immediately following the expression will be executed. You may use the command *ELSE followed by commands that will be executed if the expression is false. For more information on the expressions that may be used, see Expressions.

Arguments

expression
A boolean expression with as result true or false.

action
One or more commands that cause an action. Definition commands are not allowed. All these commands will be executed one after the other till *ELSE is encountered or the end of the command line has been reached.

Example 1

*IF [ Q6 , 1-5 ] *GOSUB "BRAND"

If Q6 is answered with an answer value between 1 and 5 the subroutine BRAND is called.

Example 2

*IF [ RAN 3 ] *GOTO 100

The generated values for RAN 3 are 0, 1 and 2. Value 0 will make the expression false and thus prevent the jump. Consequently, in roughly 67% of the cases the interview jumps to question 100.

Example 3

*IF [ Q11 = "PC" ] *GOTO 100 *ELSE *GOTO 200

The condition is true if the answer to question 11 is equal to the text "PC".

See Also