top | item 29704256

(no title)

firethief | 4 years ago

`for` is a foreach. If you want to increment a number through a range like a typical C `for`, you have to use a `while` loop. I don't really see the draw.

discuss

order

dnautics|4 years ago

man if I were andrew I'd just rename for to "foreach", because this is a huge complaint and source of confusion.

kzrdude|4 years ago

Seems fine to me. Rust has a "foreach" which is named for, working ok. Of course Rust has ranges as iterators, so it's not necessarily noticed that "there is no numerical for" but it works.

anonymoushn|4 years ago

It seems fine to just delete it if it's only ever going to work on slices and arrays