When I read threads like this I feel like I fell into a Bizzaro Universe where the simplicity of a C for loop with its explicitly exposed initialization, looping condition and next iteration stepping, without any hidden costs that you have to “keep in mind” beyond what you write, is considered undesirable.
Only to be followed by “new improved” language constructs that go into a long discussion of Iterable vs Sequence vs range operations, to wind up with a lot more code and hidden implications that must be considered (instantiation of the full list being one, foreach being about 3x slower than explicit for loop is another).
The while loop does create equivalent code but the beauty of C-for syntax was to eliminate such ugly boiler plate in the first place.
Please, don’t tell me that you are confused by C-for loop’s complex syntax or difficulty of intuiting its operation. The examples of Kotlin code you provide speak volumes to your ability to handle complexity and grasp non-intuitive constructs.
Why not admit that elimination of some language features in Kotlin, even when necessitated by other concerns, is a regression not evolution, which we live with to enjoy real improvements it offers.
Justifying it with code that resembles “perl poetry” or “obfuscated C” compared to the elegance of a C for loop is trying to put lipstick on a pig.