The each
keyword is for a single-line loop. There is a for
loop, which you can use inside a defined function (or verb).
Example:
myFunction =: 3 : 0
ls =. 1 dir '*.*'
for_file. ls do.
doSomething ;file
doSomethingElse ;file
end.
)
The for_.
variant is arguably the most useful. The name of your variable file
goes right between the underscore and the period. The important thing to remember is that the for loop will give each item as it appears in the array, so if ls
is an array of boxed strings, each file
will show up as a single boxed string.