Re: [DISCUSSION] Match expression

From: Date: Mon, 13 Apr 2020 17:01:11 +0000
Subject: Re: [DISCUSSION] Match expression
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-109609@lists.php.net to get a copy of this message
But when we do: function x() { $a = function () { return 123; } } We know that "return" here is for the current function () scope, and not for the parents one. So "return" inside inlined-switch should be used to specify the switch return itself. Seems clear to me. Atenciosamente, David Rodrigues Em seg., 13 de abr. de 2020 às 12:32, Reindl Harald <h.reindl@thelounge.net> escreveu: > > > Am 13.04.20 um 17:08 schrieb David Rodrigues: > > With all the humility of the world and without wanting to be exhaustive > > about this, my only question is why can't we keep it as a switch, instead > > of creating a new keyword? > > > > $x = switch ($y) { > > case 0: return 1; > > case 1: return 20; > > // default: return null; > > }; > > because when someone changes behavior where return is expected to return > from a function/method someone could break his fingers? > > return means "stop function or include" and not "stop switch statement" >

« previous php.internals (#109609) next »