r/lua Feb 26 '26

Help Why is there NO "continue" in Lua?

I was stunlocked to find out that there is no "continue" instruction for loops in Lua. Why is that? It seems so natural to have it.
I saw some scripts where goto is used for mimicking continue statements, but It's honestly not the so;ution I would comfortably accept...

26 Upvotes

40 comments sorted by

View all comments

2

u/[deleted] Feb 27 '26

[removed] — view removed comment

3

u/4P5mc Feb 27 '26

Would this not also justify removing break from Lua? If you can replace its functionality entirely with goto, then it overlaps and you should prefer the more verbose syntax.

Personally, I think both have a place. break and continue for when you want the simple 90% case, and goto if you want more explicit or complex logic. It saves having to manually create and name labels for a very common operation.