Skip to content

Latest commit

 

History

History

loop

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Loop

Introduces the foreach construct together with only(x) and exclude(x) filters

integer :: array(20) = [(i, i = 1, 20, 1)]

foreach(x, array)
    print*, int(x)
endfor

foreach(x, array) exclude(mod(x, 2) /= 0)
    print*, int(x)
endfor

foreach(x, array) only(mod(x, 2) == 0)
    print*, int(x)
endfor

In this example, x must not be defined. It will be used in a associated construct once expanded. So you are free to pick any name.