I memorized it this way: "do ... end" is a new scope. for, while, etc expand on it.
If your code have variables or functions that run only once during runtime you can put them in a new scope so that they can be removed from memory during the "normal" runtime of your code.
Lua Code:
local setting
do
local result = false
local function check()
return true
end
result = check()
setting = result
end