Skip to content

Instantly share code, notes, and snippets.

@brendtumi
Created January 6, 2018 23:37
Show Gist options
  • Save brendtumi/fb6a7d9454e47b4cf24710c3a7e697cd to your computer and use it in GitHub Desktop.
Save brendtumi/fb6a7d9454e47b4cf24710c3a7e697cd to your computer and use it in GitHub Desktop.
FizzBuzz in Rust
fn main() {
for i in 1..101 {
let mut output = "".to_string();
if i % 3 == 0 {
output = output + "Fizz";
};
if i % 5 == 0 {
output = output + "Buzz";
};
if output == "" {
output = i.to_string();
};
println!("{}", output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment