Skip to content

Instantly share code, notes, and snippets.

@stasimus
Last active November 13, 2018 12:59
Show Gist options
  • Save stasimus/81e007b25bc034eb838f5935c382c088 to your computer and use it in GitHub Desktop.
Save stasimus/81e007b25bc034eb838f5935c382c088 to your computer and use it in GitHub Desktop.
val p1: String? = null
val p2: String? = "p2"
assertNull(concat2(p1, p2))
/* Almost ternary operator */
fun concat2(arg1: String?, arg2: String?): String? {
return if (arg1 != null && arg2 != null) arg1 + arg2 else null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment