[REBOL] Re: Multiple Word Conditional?
From: joel:neely:fedex at: 16-Nov-2000 12:57
Hi, Rodney,
I believe it was Gabriele... (Credit where credit is due, and
all that...)
[rebol-bounce--rebol--com] wrote:
> Given three mutually exclusive refinements in a function
> (or just three words in a script), what is the best way
> to perform the conditional?
>
> one: false
> two: false
> three: true
>
> Of course we can do:
>
> either one [print "1"] [either two [print "2"][print "3"]]
>
> but this gets ugly for more than three words and I thought
> that someone recently posted a trick using 'any
> that made this simpler and more readable. Can't find it
> though. Any suggestions?
>
>> one: two: not three: true == false
any [
if one [print "1"]
if two [print "2"]
if three [print "3"]
]
3
>>
-jn-
--
; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677
REBOL [] foreach [order string] sort/skip reduce [ true "!"
false head reverse "rekcah" none "REBOL " prin "Just " "another "
] 2 [prin string] print ""