[REBOL] Re: a new switch-like flow-control function
From: greggirwin:mindspring at: 23-Dec-2003 9:21
AG> Hello all from a newcomer to this list,
AG> Here is a function for only 1 condition but 3 cases : if it can be
AG> useful to anyone
AG> trif: func [
AG> iftrue [block!]
AG> iffalse [block!]
AG> ifnone [block!]
For more standard REBOL style, you might consider using hyphens to
separate words. e.g.
You could also use PICK in place of a second either:
trif: func [
do either none? condition
[pick [if-true if-false] condition]
Using PICK this way isn't always the clearest choice, but sometimes it
can be quite handy.
AG> by the way,
AG> is it good that "not none" equals "true" ?
I think so. What else would you have it return?
Thanks for posting!