UL (unless)

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

UL (unless)

There are two forms of command construction using UL. The first is the simple UL construction, of the form:

UL logical expression, command,

Here, if the logical expression is false, the command is executed. If it is true, control passes to the next command. The command following UL can be any command except an IF command, a position (beginning @) or another UL command.

To execute more than one command under UL control, a block UL construction is used. The form is:

UL logical expression, THEN,

command,

...

ENDUL,

If the logical expression is false, the commands are executed. Otherwise execution continues with the command after ENDUL.

It is possible to specify an alternative set of commands to be executed if logical expression is true, using ELSE:

UL logical expression, THEN,

command ,

...

ELSE,

command,

...

ENDUL,

Here, the first set of commands are executed if the logical expression is false, and the second set if the logical expression is true.

Finally, it is possible to specify several sets of commands, the execution of each set to be dependent on different logical expressions, as follows:

UL logical expression, THEN,

command,

...

ELSEUL logical expression, THEN,

command,

...

ELSE,

command,

...

ENDUL,

Here, only one of the sets of commands will be executed, the set corresponding to the first logical expression found false. Typically, the last ELSE in such a construction will be unconditional, to catch all records not processed in the block so far.

Note that UL may be nested up to 16 levels.

IMPORTANT: the commas after THEN and ELSE must be present.

Examples of UL commands:

ul $age/1, go to @20,

ul $436/5, then,

el 'Illegal record',  

go to finish,  

endul,