Created
October 9, 2013 10:17
-
-
Save spoertsch/6899128 to your computer and use it in GitHub Desktop.
IPSWAYS Scala Meetup - OO preconditions
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
// Class preconditions | |
case class ScoreCond(p1: Int, p2: Int) { | |
require(p1 != p2) | |
require(p1 > 0 && p2 > 0) | |
} | |
ScoreCond(1, 2) | |
// Unerlaubte Werte führen zu einer Illegal argument exception | |
//ScoreCond(5, 5) | |
//ScoreCond(5, -2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment