Re: [RFC] switch expression
| From: | Stanislav Malyshev | Date: | Sun, 29 Mar 2020 20:35:38 +0000 |
| Subject: | Re: [RFC] switch expression | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109419@lists.php.net to get a copy of this message | ||
Hi!
> You can take a look at the tests to get a feel for what it’s like:
>
> https://github.com/php/php-src/pull/5308/files
>
> Multiple conditions are possible:
>
> ```
>
> return $day switch {
>
> 1, 7 => false,
>
> 2, 3, 4, 5, 6 => true,
>
> };
I'm still not sure why if we're calling it "switch" it can't use
traditional switch structure. If it uses something else, it must be
called by some other keyword, it's not a good idea to have two "switch"
constructs in the language with completely different syntax.
--
Stas Malyshev
smalyshev@gmail.com