[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Goto and return ('end' expected)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 7 May 2015 09:44:09 +0200
2015-05-07 9:38 GMT+02:00 Axel Kittenberger <email@example.com>:
>> I.e. an return statement must be the last statement
>> in a block. A label is a statement.
> Really since when and why?
Lua 5.2 Reference Manual, §3.3.4:
"For syntactical reasons, labels in Lua are considered statements too ...
The return statement can only be written as the last statement of a
block. If it is really necessary to return in the middle of a block,
then an explicit inner block can be used, as in the idiom do return
end, because now return is the last statement in its (inner) block. "