Case: There are continue and break together in a loop but there are more continue than break
Input
for i = 1, 10 do
if i % 3 == 0 then
continue
end
if i % 6 == 0 then
continue
end
if i % 9 == 0 then
continue
end
if i % 10 == 0 then
break
end
end
Output
for i = 1, 10 do
local __DARKLUA_REMOVE_CONTINUE_break5784919bbab63ddf=false repeat if i % 3 == 0 then
break
end
if i % 6 == 0 then
break
end
if i % 9 == 0 then
break
end
if i % 10 == 0 then
__DARKLUA_REMOVE_CONTINUE_break5784919bbab63ddf=true break
end
until true if __DARKLUA_REMOVE_CONTINUE_break5784919bbab63ddf then break end end
Case: There are continue and break together in a loop but there are more break than continue
Input
for i = 1, 10 do
if i % 3 == 0 then
break
end
if i % 6 == 0 then
break
end
if i % 9 == 0 then
break
end
if i % 10 == 0 then
continue
end
end
Output
for i = 1, 10 do
local __DARKLUA_REMOVE_CONTINUE_continue5784919bbab63ddf=false repeat if i % 3 == 0 then
break
end
if i % 6 == 0 then
break
end
if i % 9 == 0 then
break
end
if i % 10 == 0 then
__DARKLUA_REMOVE_CONTINUE_continue5784919bbab63ddf=true break
end
until true if not __DARKLUA_REMOVE_CONTINUE_continue5784919bbab63ddf then break end end
Case: There is only continue in a loop
Input
for i = 1, 10 do
if i % 5 == 0 then
continue
end
print(i)
end
Output
for i = 1, 10 do
repeat if i % 5 == 0 then
break
end
print(i)
until true end
Note
blake3 used for exit variable name (break_variable_name, continue_variable_name)
TO-DOs
[x] Add tests for cases where continue and break are mixed.
Closes #202
Cases
Case: There are
continue
andbreak
together in a loop but there are morecontinue
thanbreak
Input
Output
Case: There are
continue
andbreak
together in a loop but there are morebreak
thancontinue
Input
Output
Case: There is only continue in a loop
Input
Output
Note
blake3
used for exit variable name (break_variable_name
,continue_variable_name
)TO-DOs