Skip to content

Instantly share code, notes, and snippets.

@patrickcousins
Created November 3, 2019 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickcousins/d006a270c8b3e58b6b741df98229c0b5 to your computer and use it in GitHub Desktop.
Save patrickcousins/d006a270c8b3e58b6b741df98229c0b5 to your computer and use it in GitHub Desktop.
fun calculateDiscount(person: Person) : Int {
return when {
person.over65() -> 20
person.under13() -> 10
person.isRich() -> 0
else -> 5
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment