Index

while(clause) {commands}

Repeatedly run a set of commands while a given boolean clause is true.

Arguments:
clause
The Boolean expression that is evaluated just before each new iteration of the loop. If it evaluates to true, then the commands of the while loop are executed again. If it evaluates to false, execution of the loop is terminated.
commands
The block of commands that the loop executes.

Example:
The following example uses a while loop to alternate between observing a calibrator source and a target source, during the time window of 3:30 to 4:15 local sidereal time. The preceding until command is there because otherwise if the while loop was encountered before 3:30 LST, its clause would be false so it would be skipped.
 until $after(3:30, LST)
 while($between(3:30, 4:15, LST)) {
   track 3c286
   until $elapsed >= 1m
   track 3c345
   until $elapsed >= 10m
 }
Context:
While loops are used to repeatedly execute a sequence of commands, while a given condition is true. The loop can be exited before the condition becomes false by using the break command. Similarly, the next iteration of the loop can be started before the current iteration has been completed via the next command.

Martin Shepherd (9-Oct-1997)