Created
May 22, 2012 05:19
-
-
Save Dubhead/2766800 to your computer and use it in GitHub Desktop.
FizzBuzz in Rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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