Last active
December 14, 2017 23:54
-
-
Save madeleine-chercover-hs/a352b284f94265ee9242f692ad4b7901 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
def eatVegetable(vegetable: Vegetable): String = | |
vegetable match { | |
case Pea(colour, isCooked) => | |
s"Oh great, a ${if (isCooked) "uncooked" else "cooked" } $colour pea." | |
case Eggplant(colour, _) => | |
s"No matter how I cook this $colour eggplant, it'll still be the blandest vegetable around." | |
case ChocolateCake(layers, _) => | |
s"Yum, a $layers-layer chocolate cake – the best vegetable of all." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment