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.rei...@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"
>

Reply via email to