For

The verb FOR repeats a statement block several times.
Format:
for ( init-statement ; expression ; post-block-statement )
statements
...
[continue]
...
[break]
...
endfor

For-loops can be nested to any depth.

The init-statement is executed once before the block. The expression is evaluated after the execution of the statement block. That means the statement block is executed at least once. If the expression is 0, the loop terminates. The post-block-statement is executed before the expression is evaluated. The init-statement and the post-block-statement can be any valid SPECTRA command, although it is likely to be that these statements look like "i=0" and "i = i + 1".

The verb continue terminates the execution of the statement block and carries on with the post-block-statement. If the expression is non-zero, the next iteration is entered.

Break terminates the loop. Control is transfered to the first statement that follows the loop.

e.g.: 
for (i=1; i < (max + 1); i = i + 1) 
  if !search_scan( i) then continue     
  if yesno( " i= "i", leave the loop? ") 
    break 
  endif 
  set i/x_min=-5/x_max=5 
  delete i.1 i.4 
endfor
The x-window limits of the SCANs in slot 1 to MAX are set to -5 and 5 and the first four lines of text are deleted.