Comparable<Boolean> should be usable in if-statements
Classes that implement Comparable should be able to be used as boolean expressions (or at least in if-statements)
Example:
class Test: Comparable {
/* ... */
}
fun main() {
val x = Test()
if (x) {
println("true!")
}
}
Why?
A if-statement compares something to true, and Comparable is meant for comparisions
1 post - 1 participant
Read full topic