|
Revision 1, 483 bytes
(checked in by krobillard, 3 years ago)
|
|
Import orca & thune.
|
| Line | |
|---|
| 1 | REBOL [ |
|---|
| 2 | Purpose: {Test 'disarm, 'try, 'catch, & 'throw'.} |
|---|
| 3 | ] |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | ; Old versions just print ?object?. |
|---|
| 7 | ; Mold in newer versions print the object values. |
|---|
| 8 | print disarm try [do %file_does_not_exist] |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | f: func [a] [if a > 2 [throw "too big"] "ok" ] |
|---|
| 12 | print f 2 |
|---|
| 13 | print catch [f 2] |
|---|
| 14 | print catch [f 3] |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | f: func [a] [if a > 2 [throw/name "too big" 'big] "ok" ] |
|---|
| 18 | print f 2 |
|---|
| 19 | print catch [f 2] |
|---|
| 20 | print catch/name [f 3] 'big |
|---|
| 21 | |
|---|
| 22 | catch [ |
|---|
| 23 | print catch/name [f 3] 'some |
|---|
| 24 | print "inner" |
|---|
| 25 | ] |
|---|
| 26 | print "outter" |
|---|
| 27 | |
|---|