Proposal: switch statement multiple

Juan Pablo Garcia sarabadu at gmail.com
Thu Feb 21 01:38:31 UTC 2019


Yes was only a draft idea, but pattern matching proposal does the job

El El mié, 20 feb. 2019 a las 22:29, Waldemar Horwat <waldemar at google.com>
escribió:

> 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.
>
>      Waldemar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190220/7753e486/attachment.html>


More information about the es-discuss mailing list