|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 3-Aug-2010 Edit History|
Catches a throw from a block and returns its value.
block [block!] - Block to evaluate
/name - Catches a named throw
word [word! block!] - One or more names
/quit - Special catch for QUIT native
catch and throw go together. They provide a way to exit from a block without evaluating the rest of the block. To use it, provide catch with a block to evaluate. If within that block a throw is evaluated, it will return from the catch at that point.
write %file.txt "i am a happy little file with no real purpose" print catch [ if exists? %file.txt [throw "Doc found"] "Doc not found" ] Doc not found
Editor note: Example with /name
Editor note: Example of using catch in a function spec.
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|