Created
October 1, 2020 13:51
-
-
Save okaminu/8b8e4b64893bd291bccf32cc8400e705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Greeter { | |
def greet(likeAPirate: Boolean, age: Some[Int]): String = | |
if (likeAPirate && age.nonEmpty) { | |
if (age.get >= 18) "Care to join for a bottle of rum ?" else "Ahoy" | |
} else "Hello" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment