Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Expressions > Foreach iterator

Foreach iterator

The Foreach iterator takes an iterable value on the left side and an inline function (e.g., a closure) on the right side. The expression iterates through the keys and elements generated by enumeration and calls on each cycle the given closure with (element, keyOfElement) parameters.

Expression yields the return value from the last call to closure, or undefined if enumeration was empty.

  foreach-expr := expr "foreach" inline-function  
See also  | Expressions  | Grammar
Contributes notes:
Add a note
What's new | Anvil