-
-
Save jpastuszek/439a7e8864c14a9d8237 to your computer and use it in GitHub Desktop.
Brake lines iterator
This file contains 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 d = ["A", "B", "C", "D", "E", "F", "G"]; | |
let out = d.iter().enumerate().map(|(i, &l)| ((i + 1) % 3 == 0, l)); | |
for (ln, l) in out { | |
print!("'{}'", l); | |
if ln { | |
println!(""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://is.gd/FouH8g