News for hackers. Stuff that matters.
Re:Odin Programming Language by xigoi on Saturday February 19, 2022 @12:57PM (#30399002)
>As for C-style for loops, they are not obsolete by any stretch and any one who thinks so in think that the compiler can easily optimize a magical complex iterator without any problem.

In Nim, non-closure iterators are guaranteed to be inlined, so `for i in 0..<16` always compiles to what you'd write in C.

>In languages without C-style for loops, you'll see people try to emulate them regardless with variables and a while loop, not just an iterator.

There's no “emulation” going on. A C-style for loop is literally just different syntax for a while loop.

There are no comments on this comment yet.