Skip to content

Instantly share code, notes, and snippets.

@RobertApikyan
Created February 13, 2018 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertApikyan/c718105a7c736f83b90b4b0879373d94 to your computer and use it in GitHub Desktop.
Save RobertApikyan/c718105a7c736f83b90b4b0879373d94 to your computer and use it in GitHub Desktop.
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