Why can "return" and "break" appear only as the last statement in a block of Lua code? -


as lua manual states: http://www.lua.org/pil/4.4.html

i'm interested in technical limitations or constraints, not answers pertaining taste or coding standards.

it seems odd constraint me, given hanging return can added statement do return end.

to quote 1 of lua authors in e-mail on lua mailing list:

for return statement, it's because otherwise may ambiguous:

... return f(1,2,3) ... 

is return no values or tail call f?

the restriction on break statement leftover experimental break-with-labels. "break f(x)" coud "break f" followed "(x)".

for lua 5.2 , restriction break has been lifted.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -