next up previous contents index
Next: FOR /WHILE Up: FOR Previous: FOR Indexed   Contents   Index


FOR /IN

        [SIC\]FOR Loop_Variable /IN List_Variable

    Execute  a  generalized  loop,  for  all  the  values  in List_Variable.
    List_Variable is a 1-D (or scalar) variable of any type,  i.e. numerics,
    logicals,  or character strings.  The loop variable is undefined outside
    the loop, and must not be previously defined. It will be implicitly  de-
    fined  as a scalar with the same type and kind as the List_Variable. For
    example:
            DEFINE CHARACTER*8 files[3]
            LET files "a.txt" "b.txt" "c.txt"
            FOR f /IN files
              SAY 'f'
            NEXT f
    The loop executes with the Loop_Variable taking the value of  each  ele-
    ment of the List_Variable, in order.


Gildas manager 2024-03-29