Re: New Switch Idea
- Posted by Critic Mar 28, 2009
- 1099 views
My proposal:
select value do case 1, 2, 3, 5..78: doA() case 6, 99: doB() else doC() end select switch value do case 1, 2, 3, 5..78: doA() case 6, 99: doB() else doC() end switch
The only difference between "switch" and "select" is that "switch" falls through, "select" does not. To avoid a fallthrough inside a "switch" a "break" statement could be allowed. Personally, I would omit "switch" completely as it is not often needed and confusing, especially since EU also targets hobby programmers. But I included it in my proposal because others want the feature.