MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / if_buzz

Function if_buzz

06_pattern_matching/rust/fizzbuzz.rs:2–12  ·  view source on GitHub ↗
(x: i32)

Source from the content-addressed store, hash-verified

1fn main() {
2 fn if_buzz(x: i32) {
3 if x % 15 == 0 {
4 println!("FizzBuzz")
5 } else if x % 3 == 0 {
6 println!("Fizz")
7 } else if x % 5 == 0 {
8 println!("Buzz")
9 } else {
10 println!("{}", x)
11 }
12 }
13
14 let fizz_buzz = |x| match (x % 3, x % 5) {
15 (0, 0) => println!("FizzBuzz"),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected