r/shittyprogramming • • Oct 06 '21

FizzBuzz compact version

fn main(){for num in 1..101{if num%5==0&&num%3==0{println!("FizzBuzz")}else if num%5==0{println!("Buzz")}else if num%3==0{println!("Fizz")}else{println!("{}",num)}}}
48 Upvotes

11 comments sorted by

View all comments

Show parent comment

4

u/[deleted] Oct 11 '21

I'm not sure if rust has ternaries lol, next I'll try a macro to get it shorter