nick34992
4/12/2017 - 4:46 PM

Rust: For Loop, Enumerate

Rust: For Loop, Enumerate

fn main() {
    let lines = "hello\nworld".lines();
    
    for (linenumber, line) in lines.enumerate() {
        println!("{}: {}", linenumber, line);
    }
}