The EASI FOR command provides a simple looping construct over a series of numeric values.
FOR iter_var = start_val TO end_val [BY incr_val] statement_list ENDFOR
The FOR statement initializes the iteration variable to the initial value, checks it against the end value, and if the end value is not exceeded it executes the statement list. When the ENDFOR statement is reached, the iteration variable is increased by the increment value and compared to the end value. If the end value is not exceeded, the statement list is executed again.
The start value may be greater than the end value and the increment value may be negative, but if the increment value does not take the iteration variable value closer to the end value each iteration, the FOR loop will never terminate.
It is possible to alter the value of the iteration variable inside the FOR loop and also to use GOTO's to escape or enter the loop. Using GOTO is the preferred way to quit the FOR cycle in special conditions especially in case of quitting several nested loops. It is not recommended to jump into a FOR loop since it is implementation dependent and may not work in future versions of EASI.
The following example runs CLR on the first 128 channels of the PCIDSK file hyper1.pix in groups of 16 channels at a time.
local i,j file = "hyper1.pix" valu = 0 for i = 1 to 128 by 16 for j = 1 to 16 dboc(j) = i + j - 1 endfor run clr endfor
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.