[REBOL] Re: to-string do question?
From: carl:cybercraft at: 24-Dec-2003 22:24
On 23-Jul-03, bryan wrote:
> 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...
> 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.
> okay I've tried that, seems to have a problem though, if what is
> being done is write %newfile.txt read %rlt.txt and rlt.txt does not
> exist then err does not have a value.
Are you sure?
>> read %rlt.txt
** Access Error: Cannot open /rebol/rlt.txt
** Near: read %rlt.txt
(just to show %rlt.txt doesn't exist. So...)
>> err: error? try [
[ returnstring: to-string do "write %newfile.txt read %rlt.txt"
>> ? err
ERR is a logic of value: true
Isn't that what you get? Or have I misunderstood something?