AIPS HELP file for TO in 31DEC22
As of Sat Jun 3 22:14:32 2023
Use: In the FOR loop construction TO is used to seperate the
starting value for the incrementing variable from the limiting
value. (See FOR).
Grammar: FOR variable = start TO fini BY increment
statement1; statement2;... ; END
where 'variable' is a scalar variable that will change each
time through the loop, beginning at 'start', have 'increment'
added to it each time through the loop (the increment may be
positive or negative) and will end when the loop has been
executed with 'variable' greater than or equal to 'fini'. Note
that this implies that the loop will be executed at least once
no matter what the start, fini and increment parameters are.
If the BY section is omitted, the increment will default to 1.
Statementi are AIPS statements. These statements may not
have an omitted optional immediate numeric argument. Such
statements depend on the POPS stack being empty in the absence
of the argument. But the FOR loop uses the stack for the
'fini' and 'increment' values and so the stack is not empty.
Thus TVON with no argument will see a non-empty stack and
assume that it is getting an immediate argument from the stack.
Use in this case TVON(2**(TVCHAN-1)) inside your loop.
Verbs of this sort include EHEX, GROFF, GRON, HUEWEDGE,
IMWEDGE, REHEX, TVOFF, TVON, TVWEDGE.
Examples: FOR I = 1 TO 10; SUM = SUM + A(I); END
FOR I = K+3 TO K BY -1; A(I+1) = A(I); END
In the first example SUM will be incremented by the
sum of the first 10 elements in array A.
The second example will shift the section of array
A between A(K) and A(K+3) forward 1 element.