Created
January 24, 2016 10:58
-
-
Save Jire/46b1ee35855a5e97bfd5 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
| class Ternary<T>(val condition: Boolean, val whenTrue: T) { | |
| operator fun minus(whenFalse: T) = if (condition) whenTrue else whenFalse | |
| } | |
| operator fun <T> Boolean.plus(whenTrue: T) = Ternary(this, whenTrue) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment