Jump to content

Rebol Programming/forall

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
FORALL 'word body 

DESCRIPTION:

[edit | edit source]

Evaluates a block for every value in a series.

FORALL is a function value.

ARGUMENTS

[edit | edit source]
  • word -- Word set to each position in series and changed as a result (Type: word)
  • body -- Block to evaluate each time (Type: block)

(SPECIAL ATTRIBUTES)

[edit | edit source]
  • catch
  • throw

SOURCE CODE

[edit | edit source]
forall: func [
    "Evaluates a block for every value in a series." 
    [catch throw] 
    'word [word!] {Word set to each position in series and changed as a result} 
    body [block!] "Block to evaluate each time"
][
    throw-on-error [forskip :word 1 body]
]