Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created November 14, 2014 06:53
Show Gist options
  • Save mattdeboard/35b4e807dad8042f6dae to your computer and use it in GitHub Desktop.
Save mattdeboard/35b4e807dad8042f6dae to your computer and use it in GitHub Desktop.
fn fizzbuzzinator (x: int) -> &'static str {
if x % 3i == 0i && x % 5i == 0i { "FizzBuzz" }
else if x % 3i == 0i { "Fizz" }
else if x % 5i == 0i { "Buzz" }
else { "" }
}
fn main() {
for i in range(0i, 100i) {
let val: &str = fizzbuzzinator(i);
if val == "" { continue; };
println!("{} {}", i, val)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment