Rebol Programming/func

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:

[edit | edit source]
FUNC spec body 

DESCRIPTION:

[edit | edit source]

Defines a user function with given spec and body.

FUNC is a function value.

ARGUMENTS

[edit | edit source]
  • spec -- Help string (opt) followed by arg words (and opt type and string) (Type: block)
  • body -- The body block of the function (Type: block)

(SPECIAL ATTRIBUTES)

[edit | edit source]
  • catch

SOURCE CODE

[edit | edit source]
func: func [
    "Defines a user function with given spec and body." 
    [catch] 
    spec [block!] {Help string (opt) followed by arg words (and opt type and string)} 
    body [block!] "The body block of the function"
][
    throw-on-error [make function! spec body]
]