Skip to content

Instantly share code, notes, and snippets.

@patrickcousins
Created November 3, 2019 03:09
Show Gist options
  • Save patrickcousins/0ea246388fcfb525e167cf81695deb95 to your computer and use it in GitHub Desktop.
Save patrickcousins/0ea246388fcfb525e167cf81695deb95 to your computer and use it in GitHub Desktop.
fun calculateDiscount(person: Person) : Int {
return when {
person.age > 65 -> 20
person.age < 13 -> 10
person.income > 1_000_000 -> 0
else -> 5
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment