Index

if(clause) {commands} else if(clause) {commands} else {commands}

Conditionally execute one of a number of blocks of commands.

Arguments:
clause
A Boolean expression that determines whether a block of commands will be executed. The block of commands that follows the first true clause is executed. Otherwise the else part is executed, if present.
commands
A block of commands to be executed if its controlling clause is the first true clause.

Example:
The following example looks at the current sidereal time to decide which calibration source to observe.
 if($after(18:45,LST)) {
   track 3c345
 } else if($after(12:30,LST)) {
   track 3c273
 } else {
   track 0552+398
 }
Context:
The if command executes each if() clause until one evaluates to true, or the else statement is reached. It then executes the block of commands that follow that clause (or else statement), and skips the rest of the else clauses.

Martin Shepherd (9-Oct-1997)