REBOL [
Title: "Throwing and Catching Named Values"
Author: "Jeff Kreis"
Email: jeff@rebol.com
File: %catcher.r
Date: 16-Jun-1999
Purpose: {
Throwing and catching functions.
}
Category: [misc script 3]
]
random/seed now
catcher: func [][
return catch/name [
return catch/name [
if random true [
throw/name func [][print "I am primus"] 'primus
]
if random false [
throw/name func [][print "I am secondus"] 'secondus
]
func [][print "I made it through untouched!"]
] 'secondus
] 'primus
func[][print "How'd I get down here?"]
]
loop 20 [do catcher]