How about this implementation change, which is favoured by Cyphre,
Gabriele and Anton, as it looks? (disadvantage - it is slower than the
original due to the double search)
switch1: func [
"Selects a choice and evaluates what follows it."
[throw]
value "Value to search for."
cases [block!] "Block of cases to search."
/default case [block!] "Default case if no others are found."
/local blk
][
value: find cases value
if value [value: find next value block!]
either value [do first value] [if default [do case]]
]
example: [
switch1 1 [2 4 6 ['even] 1 3 5 ['odd]]
]
-Ladislav
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.