Created
August 15, 2018 18:43
-
-
Save SUPERCILEX/9fb0f9354ffa0685caab2bb4843f1b06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infix fun <T> Boolean.q(primary: T) = if (this) Ternary(primary) else null | |
infix fun <T> Ternary<T>?.e(other: T) = if (this == null) other else result | |
data class Ternary<T>(internal val result: T) | |
val bool = true | |
println(bool q "true" e "false") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment