Hi Eric,

>SEND doesn't return a value, so TRY doesn't return one either. As a
>result all the set-word error: sees is the unset! value, which produces
>the error. 

Exactly.

>If you add 'true to the end of the try block, that
>ensures you'll have some value to set 'error to. 


1. A better way to do it would be to use set/any 'error try [...] as in:

>> either error? set/any 'error try [print "hi"] [
  print "error"
] [ 
  print "no error" 
]
hi
no error

>> either error? set/any 'error try [print 1 / 0] [
  print "error"
  ] [ 
  print "no error" 
  ]
error


;- Elan [ : - ) ]
    author of REBOL: THE OFFICIAL GUIDE
    REBOL Press: The Official Source for REBOL Books
    http://www.REBOLpress.com
    visit me at http://www.TechScribe.com


Reply via email to