Re: New switch/case idea
- Posted by jimcbrown (admin) Apr 05, 2009
- 1770 views
switch X on doesn't make quite the same sense to me. If I were to use switch X on, I would think it should be switch on X do case 1 etc... Because we are switching on X.
switch X on case 1 then case 2 then end switch
That reads that we are switching on case 1 or case 2 but we are switching on X, not the case statements. So, switch on X do makes sense, but is more verbose than switch X do, adds no clarity and doesn't get rid of do.
Jeremy
switch X on ... would be read in english as the following sentence:
switch X on the the following cases: on case 1 then do this, on case 2 then do that, etc.
That seems perfectly clear to me. Alternatively,
switch X from ... would be read in english as the following:
switch on X from cases 1 .. to 9: on case 1 then do this, on case 2 then do that, etc.
Although, switch X from uses an existing keyword (which means it might cause the same problem in the Russian version as 'do') and from is two more characters to type out than do or on.