Created
January 12, 2014 00:05
-
-
Save depp/8378663 to your computer and use it in GitHub Desktop.
Iterate over a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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