I am sorry I do not understand but this is due to my ignorance
Where do lexical block start? They end at “end”, they can start with “do”.
Also I assumed lexical blocks start with the function definition and end at their end.
Does “then” introduce a new lexical block which can end with “else” or “end”? Is this the way it works in Lua?
Andrea
Yes, each time you enter a conditional block, do-block, or loop, you can declare variables that will go out of scope at the end of that block. Bonus fact: the iteration variables in for loops in lua go out of scope between iterations of the loop.
If you are familiar with _javascript_, I believe this is the same as _javascript_'s let and const, and Python's behavior is the same as _javascript_'s var.