Skip to content

Instantly share code, notes, and snippets.

@idarlington
Last active August 18, 2021 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idarlington/2faa75d6a3fc8afdac87dd3b48855671 to your computer and use it in GitHub Desktop.
Save idarlington/2faa75d6a3fc8afdac87dd3b48855671 to your computer and use it in GitHub Desktop.
object CracklePop {
def main(args: Array[String]): Unit = {
(1 to 100).collect {
case number if (number % 5 == 0) && (number % 3 == 0) => println("CracklePop")
case number if number % 5 == 0 => println("Pop")
case number if number % 3 == 0 => println("Crackle")
case number => println(number)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment