Index

do datatype variable=start,stop,increment {commands}

Repeatedly run a set of commands while stepping the value of a local variable.

Arguments:
datatype variable
The datatype and name to give the loop variable.
start
A first value to give the loop variable. This must be an expression or constant of the same datatype as the loop variable.
stop
A stopping value to give the loop variable. This must be an expression or constant of the same datatype as the loop variable. The loop may stop before reaching this value if the increment can't divide stop-start into an integral number of divisions.
start
The amount to increment the loop-variable at the end of each iteration of the loop. The datatype of this increment should be found documented in the help file for the datatype of the loop variable.
commands
The block of commands for the loop to execute during each iteration.

Example:
The following example uses two nested do-loops to scan a rectangular grid of points 2 arcminutes apart in azimuth and elevation.
 do PointingOffset daz = -0:10, 0:10, 0:2
   print "Moving to azimuth offset=", $daz
   do PointingOffset del = -0:10, 0:10, 0:2
     print "Moving to elevation offset=", $del
     offset/set az=$daz, el=$del
     ...other commands...
   }
 }
Context:
Do loops are used to repeat the execution of a sequence of commands for each of a grid of values assigned to a loop variable. 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 (24-Oct-1999)