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

[REBOL] Using Switch with Words ??

From: tim::johnsons-web::com at: 31-Oct-2001 18:10

Hello All: Time to banish all questions about switches :>) Now I would like to use 'switch such that an argument is evaluated agains word values. Not being clear here... I know - so here is the example: x1: 1 ;treat as global x2: 2 x3: 3 switch-with-words: func[arg][ switch/default arg[ x1[print "equal to x1"] x2[print "equal to x2"] x3[print "equal to x3"] ][print "no case"] ] switch-with-words 3
>>no case
Oh fudge! I was hoping to see "equal to x3" Now how can I write 'switch-with-words to get equal to x3 as the result. Thanks again! -- Tim Johnson <[tim--johnsons-web--com]>