Posted 03 February 2015 - 05:36 PM
Original idea:
In some languages there is a command called continue. What it does? In loops if you use continue the rest of the block won't be done, instead of that, the block will be done from the beginning. How to use it in lua? There's no continue in lua, but you can replace it with a little code:
The break command will work like the continue, and if you want to exit you have to set var to false and then break.
New idea:
You could use someyhing similar to this to go up in the code:
If you want to go up to the repeat just set a to false and break.
I know it's almost the same like the first example but I added this here because it's an other example that can maybe help somebody…
In some languages there is a command called continue. What it does? In loops if you use continue the rest of the block won't be done, instead of that, the block will be done from the beginning. How to use it in lua? There's no continue in lua, but you can replace it with a little code:
local var = true
while var do
repeat
(block)
until true
end
If you use this:The break command will work like the continue, and if you want to exit you have to set var to false and then break.
New idea:
You could use someyhing similar to this to go up in the code:
local a = true
repeat
repeat
(Block)
until true
until a
In the (Block):If you want to go up to the repeat just set a to false and break.
I know it's almost the same like the first example but I added this here because it's an other example that can maybe help somebody…
Edited on 01 November 2015 - 03:16 PM