Previous Topic: Parameter EvaluationNext Topic: File Editing


Flow Control

Editing a script can be controlled by inserting an if command with the result that some lines are only edited under special circumstances.

Conditions that may be queried include content, existence, or modification of a parameter.

The condition is formulated following the if or elseif keyword. The following table lists the possible queries:

Query

The query is true if

exist Par1

the parameter Par1 exists

equal Par1 Par2

parameters Par1 and Par2 match

greater Par1 Par2

parameter Par1 is larger than parameter Par2

Par1 == Par2

parameters Par1 and Par2 match

Par1 > Par2

parameter Par1 is larger than parameter Par2

Par1 < Par2

parameter Par2 is larger than parameter Par1

not condition

the condition is not fulfilled

Any strings (constants) or real parameters can be used for Par1 and Par2. Uppercase and lowercase are not differentiated when comparing Par1 and Par2. A larger than or smaller than comparison is possible with numeric values; nonnumeric values are interpreted as zero.

The commands used for flow control and their syntax are as follows:

if condition

The subsequent lines of the script are executed only, if the condition is fulfilled. The if commands can be nested. Every if command must be followed by an endif command later in the script.

else

The subsequent lines of the script are executed only, if all of the conditions of the associated if and elseif conditions are not fulfilled. No text must follow the else keyword.

elseif condition

The subsequent lines of the script are executed only, if the condition is fulfilled and the conditions of all preceding if and elseif conditions were not fulfilled.

endif

Terminates conditional editing. No text must follow the endif keyword.