2020-12-24 06:41:00 +00:00
|
|
|
// just testing continues and breaks
|
|
|
|
|
2023-02-09 21:58:25 +00:00
|
|
|
for (let x = 0; x < 700; x++) do
|
|
|
|
for (let i = 0; true; i++) do
|
|
|
|
let str = i .. "." .. x
|
2020-12-24 06:41:00 +00:00
|
|
|
if (i == 998) then
|
|
|
|
print(i .. " reached")
|
2020-12-24 06:47:21 +00:00
|
|
|
break // exits the loop
|
2020-12-24 06:41:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
print("for cont- " .. str)
|
2020-12-24 06:47:21 +00:00
|
|
|
continue // this really doesn't have much effect since the loop is restarted anyways, but this is just to prove it works as expected
|
2020-12-24 06:41:00 +00:00
|
|
|
end
|
|
|
|
|
2020-12-24 06:47:21 +00:00
|
|
|
// same example as the for loop but done manually using a while loop
|
2023-02-09 21:58:25 +00:00
|
|
|
let i = 0
|
2020-12-24 06:41:00 +00:00
|
|
|
while true do
|
2023-02-09 21:58:25 +00:00
|
|
|
let str = i .. "." .. x
|
2020-12-24 06:47:21 +00:00
|
|
|
if (i++ == 998) then
|
2020-12-24 06:41:00 +00:00
|
|
|
print("done")
|
|
|
|
break
|
|
|
|
end
|
|
|
|
|
|
|
|
print("while cont- " .. str)
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|