[REBOL] Re: Switch with refinements/hmmm!
From: nitsch-lists:netcologne at: 1-Nov-2001 18:37
RE: [REBOL] Re: Switch with refinements/hmmm!
or with a macro:
[REBOL [title: "refine-select"]
refine-select: func [block /default if-nothing /local todo] [
todo: clear []
foreach [word then-do] block [
if get word [append todo then-do]
]
if empty? todo [append todo if-nothing]
copy todo
]
test: func [/a /b /local todo] [
todo: refine-select/default [
a [print "is a"]
b [print "is b"]
] [print "nothing to do"]
? todo
do todo
]
test/a/b
test
[--result:
TODO is a block of value: [print "is a" print "is b"]
is a
is b
TODO is a block of value: [print "nothing to do"]
nothing to do
]
]
-Volker
[dockimbel--free--fr] wrote: