Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: to-string do question?

From: carl::cybercraft::co::nz at: 24-Dec-2003 22:24

On 23-Jul-03, bryan wrote:
>> Try with: >> to string! do thisstring > actually I tried with: > if error? try[returnstring: to-string do f1/text][returnstring: > "True" [if/else error? try[do f1/text][returnstring: > "False"]] > is that wrong anywhere?
I'm not sure what the... [if/else error? try[do f1/text][returnstring: "False"] block is for, as I can't see that it'd ever be evaluated. Blocks within a block being evaluated are not evaluated in REBOL unless forced to by a do or other means. ie...
>> do [print 1 [print 2] print 3]
1 3
>> do [print 1 do [print 2] print 3]
1 2 3 If you want to capture true or false as well as returnstring (when there's no error), I'd use something like this... err: error? try[returnstring: to-string do f1/text] err would then contain true or false and returnstring whatever the result of the do is if there wasn't an error. (Incidentally, if/else is deprecated in REBOL - 'either is the prefered word to use.) -- Carl Read