Loading RustViz Engine...
Print FizzBuzz sequence using tuple matching on modulo 3 and 5.
This problem is currently in blueprint template mode. Once the concept foundation is finalized, live in-browser WebAssembly compilation and test assertion runners will be enabled here.
pub fn fizzbuzz(n: u32) -> Vec<String> {
(1..=n).map(|i| match (i % 3 == 0, i % 5 == 0) {
(true, true) => "FizzBuzz".to_string(),
(true, false) => "Fizz".to_string(),
(false, true) => "Buzz".to_string(),
(false, false) => i.to_string(),
}).collect()
}