Skip to content

Instantly share code, notes, and snippets.

@depp
Created January 12, 2014 00:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save depp/8378663 to your computer and use it in GitHub Desktop.
Save depp/8378663 to your computer and use it in GitHub Desktop.
Iterate over a string
fn main() {
let mut x = "hello".chars();
while (true) {
match x.next() {
Some('o') => return,
Some(c) => println!("Char: {}", c),
None => return
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment