public
Created

Minimal FizzBuzz implementation in Scala

  • Download Gist
FizzBuzz.scala
Scala
1 2 3 4 5 6 7 8 9 10 11 12
package org.scalabound.scatdd
 
object FizzBuzz {
def eval(x: Int) = (x % 3, x % 5, x) match {
case(0, 0, _) => "FizzBuzz"
case(0, _, _) => "Fizz"
case(_, 0, _) => "Buzz"
case _ => "" + x
}
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.