Jump to content

Rebol Programming/foreach

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
FOREACH 'word data body 

DESCRIPTION:

[edit | edit source]

Evaluates a block for each value(s) in a series.

FOREACH is a native value.

ARGUMENTS

[edit | edit source]
  • word -- Word or block of words to set each time (will be local) (Type: get-word word block)
  • data -- The series to traverse (Type: series)
  • body -- Block to evaluate each time (Type: block)

SOURCE CODE

[edit | edit source]
foreach: native[
    "Evaluates a block for each value(s) in a series." 
    'word [get-word! word! block!] {Word or block of words to set each time (will be local)} 
    data [series!] "The series to traverse" 
    body [block!] "Block to evaluate each time"
]