[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) now available
- From: Dirk Laurie <dpl@...>
- Date: Tue, 14 Jun 2011 15:12:49 +0200
On Tue, Jun 14, 2011 at 03:05:24PM +0200, Jerome Vuarand wrote:
> 2011/6/13 Roberto Ierusalimschy <firstname.lastname@example.org>:
> >> 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.
> But then shouldn't "return; a = 3" be allowed ?
if test then return end; a=3 -- OK
if test then return else a=3 end -- OK
if test then return; a=3 end -- what's this supposed to mean?
function x() print "gotcha!" return; a=3 end -- never reaches a=3
IMHO there is no situation in which "return; a = 3"
can be milked into making sense.