Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2015 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/0783663b3378246ff738 to your computer and use it in GitHub Desktop.
Save anonymous/0783663b3378246ff738 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn main() {
let values = vec![1, 2, 3];
for x in values {
println!("{}", x);
}
// Rough translation of the iteration without a `for` iterator.
let values = vec![1, 2, 3];
let mut it = values.into_iter();
loop {
match it.next() {
Some(x) => println!("{}", x),
None => break,
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment