Skip to content

Instantly share code, notes, and snippets.

@dd86k
Created April 6, 2016 03:48
Show Gist options
  • Save dd86k/4d9a5e7f8d539513f356697cbc4b372e to your computer and use it in GitHub Desktop.
Save dd86k/4d9a5e7f8d539513f356697cbc4b372e to your computer and use it in GitHub Desktop.
Rust FizzBuzz two-liner
fn main() {
let mut x;
for i in 0..101 { println!("{}", if i % 15 == 0 { "FizzBuzz" } else if i % 5 == 0 { "Buzz" } else if i % 3 == 0 { "Fizz" } else { x = format!("{}", i);x.as_str() } ); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment