Created
April 13, 2024 13:57
-
-
Save mitiko/9e48e387f5256b6d37da773846283747 to your computer and use it in GitHub Desktop.
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
// https://twitter.com/Lucretiel/status/1413692836755685378 | |
fn main() { | |
let fizz = ["Fizz", "", ""]; | |
let buzz = ["Buzz", "", "", "", ""]; | |
fizz.iter().cycle() | |
.zip(buzz.iter().cycle()) | |
.enumerate().skip(1).take(100) | |
.for_each(|(i, (&f, &b))| { | |
println!("{f}{b}{}", if f.is_empty() && b.is_empty() { i.to_string() } else { "".to_string() }) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment