IF, ELSE and LET statements

When assigning values to variables, optional IF, ELSE and LET conditional statements can be used.

Usage in type files

The IF, ELSE and LET statements can be used in the W line in cutout and lug type files. See Using conditional statements with the W line.

The IF statement can be used in the variable definition sections of bracket type files. See Using the IF statement.

The statements

The syntax of an IF statement is:

IF <condition> { & <condition> } { | <condition> } : <assignment> { ; <assignment> }

Note that the IF part is closed by a colon (:).

The value assignment is done if the condition is true.

The IF statement can optionally be followed by an ELSE statement:

ELSE <assignment> { ; <assignment> }

The value assignment is done if the condition in the corresponding IF statement is false.

A value assignment can be done without condition using the LET statement:

LET <assigment> { ; <assignment> }

Note: The statements must be written in capital letters and they must start at the beginning of the line.

Conditions

The syntax of a condition is:

<numerical expression> <operator> <numerical expression>

Conditions can be enclosed in parenthesis ( ) to specify precedence.

Assignments

The syntax of an assignment is:

<variable> = <numerical expression>

The variable is one of V1VZ.

Logical operators

Logical operators and & (true if both conditions are true) and or | (true if one of the conditions is true) can be used to combine several conditions.

Numerical expressions

The numerical expressions that can be used are the same as those used in the variable content line. The operators that can be used are:

= equal to
< less than
<= less than or equal to
> greater than
>= greater than or equal to
<> not equal to

Examples

IF H1>100 & H1<200 : V1 = R1+R2 ; V2 = 1.0

ELSE V1 = R1+R3 ; V2 = 2.0

LET V3 = V1*V2