Skip to content

Instantly share code, notes, and snippets.

@mitiko
Created April 13, 2024 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitiko/9e48e387f5256b6d37da773846283747 to your computer and use it in GitHub Desktop.
Save mitiko/9e48e387f5256b6d37da773846283747 to your computer and use it in GitHub Desktop.
// 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