Skip to content

Instantly share code, notes, and snippets.

@Dubhead
Created May 22, 2012 05:19
Show Gist options
  • Save Dubhead/2766800 to your computer and use it in GitHub Desktop.
Save Dubhead/2766800 to your computer and use it in GitHub Desktop.
FizzBuzz in Rust
fn main(_args: [str]) {
uint::range(1u, 21u) {|i|
let msg = alt (i % 3u, i % 5u) {
(0u, 0u) { "fizzbuzz" }
(0u, _) { "fizz" }
(_, 0u) { "buzz" }
(_, _) { #fmt("%u", i) }
};
io::println(msg);
};
}
// eof vim:set syntax=rust:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment