Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Last active January 15, 2021 10:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatilShreyas/f9ca8adabc3b702427d0898749b3180e to your computer and use it in GitHub Desktop.
Save PatilShreyas/f9ca8adabc3b702427d0898749b3180e to your computer and use it in GitHub Desktop.
interface Predicate {
fun isTrue(): Boolean
}
fun main() {
val predicate = object: Predicate {
override fun isTrue() = 10 == (5*2)
}
println(predicate.isTrue()) // prints "true"
}
fun interface Predicate {
fun isTrue(): Boolean
}
fun main() {
val predicate = Predicate { 10 == (5*2) }
println(predicate.isTrue()) // prints "true"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment