loading...

re: [Challenge] 🐝 FizzBuzz without if/else VIEW POST

FULL DISCUSSION
 

My solution in Rust:

fn main() {
    for n in 1..=15 {
        match n % 3 + n % 5 {
            0 => {
                println!("FizzBuzz");
                continue;
            }
            _ => {}
        }

        match n % 5 {
            0 => {
                println!("Buzz");
                continue;
            }
            _ => {}
        }

        match n % 3 {
            0 => {
                println!("Fizz");
                continue;
            }
            _ => {}
        }

        println!("{}", n);
    }
}
code of conduct - report abuse