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

[REBOL] Re: a new switch-like flow-control function

From: maximo:meteorstudios at: 19-Dec-2003 12:10

sorry for being late, but note that this works, straight out of the box: describe: func [x [integer!] y [integer!]] [ switch true compose [ (x = 1) ["X is one"] (y = 1) ["Y is one"] (x = 2) ["X is two"] (y = 2) ["Y is two"] (true) ["X and Y are too big!"] ] ] notice that its as easy to use as pif (its also 10% faster, on my computer).
>> describe 1 1
== "X is one"
>> describe 2 1
== "Y is one"
>> describe 2 2
== "X is two"
>> describe 3 2
== "Y is two"
>> describe 3 3
== "X and Y are too big!" -Max