We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
for (n <- 1 to 100) { if (n % 15 == 0) { println("FizzBuzz") } else if (n % 3 == 0) { println("Fizz") } else if (n % 5 == 0) { println("Buzz") } else { println(n) } }
(1 to 100).map { case n if (n % 15 == 0) => "FizzBuzz" case n if (n % 3 == 0) => "Fizz" case n if (n % 5 == 0) => "Buzz" case n => n.toString }.foreach(println)