Created
March 24, 2014 09:50
-
-
Save sebnozzi/9737379 to your computer and use it in GitHub Desktop.
Checking on properties of a sequence of cards
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 CardQuestions { | |
case class Card(number: Int, color: String) | |
val cards = Seq( | |
Card(5, "red"), | |
Card(7, "red"), | |
Card(3, "black")) | |
// Do the cards all have the same color? | |
def haveSameColor(cards: Seq[Card], ifEmpty: Boolean = true): Boolean = { | |
??? | |
} | |
// Do the cards all have the same number? | |
def haveSameNumber(cards: Seq[Card], ifEmpty: Boolean = true): Boolean = { | |
??? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment