Why use a do-end block in Lua?
- by Mayron
I keep trying to find answers for this but fail to do so. I wanted to know, what is the do-end block actually used for? It just says values are used when needed in my book so how could I use this?
Do I use it to reduce the scope of local variables by placing a function in a do-end loop and place local variables outside of the function but inside this do-end block and the variables will be seen by the function? But then can the function still be called?
Sorry for being very vague. I hope that makes sense. Maybe an illustrated example might be useful ^^