[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) now available
- From: Gé Weijers <ge@...>
- Date: Tue, 14 Jun 2011 15:31:44 -0700 (PDT)
On Mon, 13 Jun 2011, Roberto Ierusalimschy wrote:
Why break can appear middle of block but not return?
Because return may be followed by an optional expression. Something
like 'return a = 3' would confuse the parser.
There's something to be said for allowing it in the middle of a block if
it's followed directly by a label:
function foo ()
In this case the expression list after return ends when you either hit end
or a label.
Algol 68 has a similar construct (the value returned is the value of the
last expression before END or EXIT):