lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2015-05-07 9:38 GMT+02:00 Axel Kittenberger <axkibe@gmail.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. "