Created
May 29, 2023 08:10
-
-
Save s1monw1/82c54124f4a64c758b402511f7d24ef5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fun greetMammal(mammal: Mammal): String { | |
return when (mammal) { | |
is Human -> "Hello ${mammal.name}; You're working as a ${mammal.job}" | |
is Cat -> "Hello ${mammal.name}" | |
else -> "Hello unknown creature" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment