Rebol Programming/attempt

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

USAGE:[edit | edit source]

ATTEMPT value 

DESCRIPTION:[edit | edit source]

Tries to evaluate and returns result or NONE on error.

ATTEMPT is a function value.

ARGUMENTS[edit | edit source]

  • value -- (Type: any)

(SPECIAL ATTRIBUTES)[edit | edit source]

  • throw

SOURCE CODE[edit | edit source]

attempt: func [
    {Tries to evaluate and returns result or NONE on error.} 
    [throw] 
    value
][
    unless error? set/any 'value try :value [get/any 'value]
]