Re: New switch/case idea
- Posted by DerekParnell (admin) Apr 02, 2009
- 1819 views
znorq2 said...
Sorry if this has been mentioned before, but I would really like to see 'in' and 'to' keywords used in the switch statement;
a) in
Using 'in' (there might be a better choice, this is the one I used) with a sequence;
myChoices = {1,2,5,"test",-5000} myAlpha = "abcdef" switch myVar [with | without falltru] do case in myChoices then [...statements...] case in myAlpha then [...statements...] case else [...statements...] end switch
b) to
Using 'to';
switch myVar [with | without falltru] do case 1 to 50 then [...statements...] case 50 to 100 then [...statements...] case else [...statements...] end switch
These and other variants will be considered for after v4.0 has been released. We are delaying them because we need to get the basic functionality out there first and make it stable before we start adding the fancy stuff.
These are good suggestions by the way. You should add them to the Sourceforge site so we can track them.