REBOL3 tracker
  0.9.12 beta
Ticket #0000578 User: anonymous

Project:



rss
TypeWish Statusreviewed Date28-Jan-2009 04:04
Versionalpha 32 Categoryn/a Submitted byptretter
PlatformAll Severityminor Prioritylow

Summary Expand support of switch to support type logic!
Description Would like to see switch native support logic! values as its value argument.
Example code
item: true

switch item [
    true [print "Item is TRUE"]
    false [print "Item is FALSE"]
    none [print "Item is NONE"]
]

>>Item is TRUE

Assigned ton/a Fixed in- Last Update28-Jan-2009 04:24


Comments
(0000383)
BrianH
28-Jan-2009 04:23

SWITCH does support logic! and none! values, but your example had no logic! or none! values in the choice list, just words. You need to use literal logic! and none! values:

switch item [
#[true] [print "Item is TRUE"]
#[false] [print "Item is FALSE"]
#[none] [print "Item is NONE"]
]

It has been suggested recently that SWITCH recognize the words that correspond to the datatypes as being the datatypes, saving you from needing to use type?/word. We may be able to add these words as well to that suggestion. Discuss this in R3 chat.

Date User Field Action Change
28-Jan-2009 04:24 BrianH Code Modified -
28-Jan-2009 04:24 BrianH Status Modified submitted => reviewed
28-Jan-2009 04:23 BrianH Comment : 0000383 Added -
28-Jan-2009 04:04 ptretter Ticket Added -