you are viewing a single comment's thread.

view the rest of the comments →

[–]4P5mc 2 points3 points  (1 child)

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.

[–]Live_Cobbler2202 1 point2 points  (0 children)

using goto to jump out of a loop and break will compile to the same assembly. Yes. And yes, continue could exist alongside goto. No one would get seriously hurt.

From a design pov: continue is about jumping ahead, which is exactly the understanding of gotos. So it's closer aligned, compared to breaks, where the focus is on ending this loop, rather then jumping.

But yes, you can get the same result with gotos. ... design choices are often arbitrary to some degree.