[REBOL] Re: to-string do question?
From: carl:cybercraft at: 24-Dec-2003 22:24
On 23-Jul-03, bryan wrote:
> I guess I'm gonna go with:
> err: error? try[returnstring: to-string do f1/text]
> either err = true[
> append f2/text "No string output returned"
> show f2][append f2/text returnstring
> show f2]
> and say that's it. After all I'm already showing how to extend any
> url aware windows app with rebol, so I can slip a bit on the
> application.
You could shorten the above to...
either error? try [returnstring: to-string do f1/text][
append f2/text "No string output returned"
show f2
][
append f2/text returnstring
show f2
]
assuming you don't need to keep the 'err value. If you do, you could
still capture it using...
either err: error? try [returnstring: to-string do f1/text][
...etc...
Hmm - and shorter still...
append f2/text either error? try [returnstring: to-string do f1/text][
"No string output returned"
][
returnstring
]
show f2
Cuts out the duplication of 'append and 'show.
--
Carl Read