Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
infix fun <T> Boolean.then(param:T):T? = if(this) param else null
infix fun <T> T.ifNot(param: T):T? = if (this.isNull()) param else this
{
val isFirst = false
Log.d("loog","${isFirst then "First" ifNot "Second"}")
}
// output "Second"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment