Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: How can one use named constants in switch?

From: lmecir:mbox:vol:cz at: 25-Oct-2001 13:04

Hi Dave,
> I just spent a while trying to figure out why the following fails: > > case_a: 1 > case_b: 2 > > msgType: getMsg ... ; integer! > > switch msgType [ > case_a [ msgA ] > ... > ] > > this fails since the cases are variables not constants (from a C
perspective
> where case_X would be an enum or #define). Is there any way to write this
except
> switch msgType [ > 1 [ msgA ] > ... > ] > > ? Thanks, > Dave
There is, of course: switch msgType reduce [ case_a [] ... ]