Re: [RFC] Short-match

From: Date: Thu, 17 Dec 2020 15:04:56 +0000
Subject: Re: [RFC] Short-match
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-112536@lists.php.net to get a copy of this message
On Wed, Dec 16, 2020, at 6:49 PM, someniatko wrote: > match is an expression, where as if-else construction is not. > This > allows for combining it with a potential future feature of single line > functions and methods. For example (hypothetical syntax is used): > > ``` > function getNumberKind(int $number) => match { > $number > 0 => NumberKind::POSITIVE, > $number == 0 => NumberKind::ZERO, > $number < 0 => NumberKind::NEGATIVE, > } > ``` > > See how natural it looks and reads. Ah, someone gets what I'm driving toward overall. :-) --Larry Garfield

« previous php.internals (#112536) next »