Skip to content

Instantly share code, notes, and snippets.

@jpastuszek
Forked from anonymous/playground.rs
Last active March 3, 2016 17:24
Show Gist options
  • Save jpastuszek/439a7e8864c14a9d8237 to your computer and use it in GitHub Desktop.
Save jpastuszek/439a7e8864c14a9d8237 to your computer and use it in GitHub Desktop.
Brake lines iterator
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!("");
}
}
}
@jpastuszek
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment