[REBOL] Re: Switch with refinements/hmmm!
From: greggirwin:mindspring at: 31-Oct-2001 15:01
<< It sure would be nice if I could use 'switch with refinements.
I can't seem to wrap my poor little brain around that one.
Any ideas? >>
I'm not clear on what you're not clear on. :) If you mean using the /default
refinement, I understand what you mean. That threw me for a loop as well. If
that's the case, maybe this will help. The default case is a block unto
itself, after the block of defined switch cases.
test-switch: does [
prin [ref #"^-"]
switch/default type?/word ref [
object! [print "!O"]
error! [print "!E"]
word! [print "!W"]
any-function! [print "!F"]
none! [print "!-"]
block! [print "!B"]
string! [print "!S"]
integer! [print "!I"]
decimal! [print "!D"]
] [print to-string type? ref]
ref: "A" test-switch
ref: 1 test-switch
ref: 1.1 test-switch
ref: none test-switch