REBOL Programming/attempt

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

USAGE:[edit]

ATTEMPT value 

DESCRIPTION:[edit]

Tries to evaluate and returns result or NONE on error.

ATTEMPT is a function value.

ARGUMENTS[edit]

  • value -- (Type: any)

(SPECIAL ATTRIBUTES)[edit]

  • throw

SOURCE CODE[edit]

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