Skip to content

Instantly share code, notes, and snippets.

@patrickcousins
Created November 3, 2019 03:22
Show Gist options
  • Save patrickcousins/43f2a1a545dce0aad7aa7fc20fce4ab8 to your computer and use it in GitHub Desktop.
Save patrickcousins/43f2a1a545dce0aad7aa7fc20fce4ab8 to your computer and use it in GitHub Desktop.
//all the code below is in the file DiscountCalculator.kt
class DiscountCalculator {
//...
}
private fun Person.over65() : Boolean {
return this.age > 65
}
private fun Person.under13() : Boolean {
return this.age < 13
}
private fun Person.isRich() : Boolean {
return this.income > 1_000_000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment