Hacker News new | ask | show | jobs
by cygx 2257 days ago
It's a C idiom. Some people prefer `for(;;)` over `while(1)` to create infinite loops.
1 comments

I see. Just a c-style loop absent conditions. I find it kind of ugly for some reason.
Weird, since Raku has `loop { }` that means exactly that. I guess the author was not aware of it (or just doesn't like it).

EDIT: Oh, that's in the Perl (5) code. Nevermind then.

In C-like it kind of makes sense – it's 1 character shorter, and on some ancient crappy compilers it may actually run faster than while(1) since it doesn't have to check the condition every time ;)

I thought it was just some old weird hate on the while() construct. I remember a long time ago people advocating for using for() always for looping because that way the language was more regular. I thought it was a weird argument.