Skip to content

Instantly share code, notes, and snippets.

@spoertsch
Created October 9, 2013 10:17
Show Gist options
  • Save spoertsch/6899128 to your computer and use it in GitHub Desktop.
Save spoertsch/6899128 to your computer and use it in GitHub Desktop.
IPSWAYS Scala Meetup - OO preconditions
// 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