Created
June 13, 2020 09:36
-
-
Save danieloskarsson/249f8ea3d3a1862b1ac19cdcf3a3178b 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 If<T>(val any: T?, private val i: (T) -> Unit) { | |
infix fun Else(e: () -> Unit) { | |
if (any == null) e() | |
else i(any) | |
} | |
} | |
Usage: | |
If (nullableString) { | |
} Else { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment