Skip to content

Instantly share code, notes, and snippets.

@heyajulia
Created March 24, 2021 23:55
Show Gist options
  • Save heyajulia/e9fbe8eac8a992d689840d235ab74b57 to your computer and use it in GitHub Desktop.
Save heyajulia/e9fbe8eac8a992d689840d235ab74b57 to your computer and use it in GitHub Desktop.
// This strange code came to me in a dream.
fn main() {
for n in 1..20 {
println!(
"{}",
match (n % 3 == 0, n % 5 == 0) {
(true, false) => "Fizz".to_string(),
(false, true) => "Buzz".to_string(),
(true, true) => "FizzBuzz".to_string(),
(false, false) => n.to_string(),
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment