foreach command

Loops through a block of commands for each item in a list.

All Usages Examples

See also: for, while

Usages

  1. foreach variable ( list ) ... end

Loops over the contents of the given list, setting the given variable to the next item in the list at the end of each loop.

Examples

foreach i ( a b c )
    echo $i
end

foreach object ( `execute("opls -d")` )
    echo Object $object
end