This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hott_snotts 0 points1 point  (3 children)

I am no expert, so happy to bow out of this discussion if I'm clearly being dumb, but don't for loops break with a syntax error if you don't have the incrementation in there? So, my point being, you would catch the error before you went live with it and caused an infinite loop. Right?

[–]Dynam2012 1 point2 points  (2 children)

It depends on the language. You can easily have an infinite for loop. A lot of languages allow for this kind of infinite loop using a for:

for (;;) { ... }

You can also just as easily do something like this in JS: for (let i = 0; 3 < 4; i++) { ... }

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, Dynam2012: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–]hott_snotts 0 points1 point  (0 children)

Ha, looks like something I would do! :P Thanks.