Skip to content

Instantly share code, notes, and snippets.

@chikoski
Created April 10, 2013 23:40
Show Gist options
  • Save chikoski/5359400 to your computer and use it in GitHub Desktop.
Save chikoski/5359400 to your computer and use it in GitHub Desktop.
FizzBuzz in Rust
fn main(){
let mut from = 1;
let to = 100;
while from <= to{
let mut msg = "";
if(from % 15 == 0){
msg = "FizzBuzz";
}else if(from % 3 == 0){
msg = "Fizz";
}else if(from % 5 == 0){
msg = "Buzz";
}
io::println(fmt!("%03? %s", from, msg));
from = from + 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment