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

[REBOL] Re: Using Switch with Words ??

From: al:bri:xtra at: 1-Nov-2001 19:32

While it's easy to think that: switch Value [ 1 [print "one"] 2 [print "two"] ] is just like C++'s (IIRC) : switch value { 1: cout << "1"; break; 2: cout << "2"; break; } the power of Rebol is in the ability to manipulate itself. Notice that 'switch is a function, and it's second parameter is a block, so this works: Switch-Block: [ 1 [print "one"] 2 [print "two"] ] switch Value Switch-Block and then you can easily see how one can 'compose, 'load, 'do or 'reduce Switch-Block to create interesting effects. Andrew Martin ICQ: 26227169 http://valley.150m.com/