Proposal: switch statement multiple

Waldemar Horwat waldemar at
Thu Feb 21 01:29:06 UTC 2019

On 02/15/2019 08:02 PM, Juan Pablo Garcia wrote:
> I think it would be great if the switch statement allows multiple argument
> Example
> Switch(a,b)
> Case: 1,true
> Case: 1,false
> Case: 2,true
> ....

You need braces for the switch statement, and the colon goes after the expression; I assume you meant "case 1, true:"?

The syntax wouldn't work for the simple reason that the language already defines that syntax and it does something else.  switch(a,b) evaluates a for its side effect and then switches on b.  The same goes for the case expressions.


More information about the es-discuss mailing list