Re:The Path to Rust
by tatterdemalion on Thursday May 26, 2016 @01:29PM
(#11779829)
These are quite different. `.iter()` is equivalent to creating the counter and declaring both the increment and conclusion condition, only its guaranteed to correctly access each member of the collection once and to never be broken, and for many collections (e.g. arrays) it is written in a way which allows for powerful optimizations.
> .iter()
hmmm. Not far off the old
> i++ // add one to i