Skip to content

Instantly share code, notes, and snippets.

@SAMMY7th
Created March 4, 2019 05:21
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 SAMMY7th/8c55093b7e72973f94d15d0b8c35b208 to your computer and use it in GitHub Desktop.
Save SAMMY7th/8c55093b7e72973f94d15d0b8c35b208 to your computer and use it in GitHub Desktop.
就活GeekHub 提出ページ例です。 (例:ScalaでFizzBuzz)
object FizzBuzz extends App {
val result = (1 to 100).map {
case x if x % 3 == 0 && x % 5 == 0 => "FizzBuzz"
case x if x % 3 == 0 => "Fizz"
case x if x % 5 == 0 => "Buzz"
case x => x
}
result.foreach(println)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment