How do you check for null in Kotlin?
var myName:String? = null
Using safe call operator ?. and scoping function let:
myName?.let { //execute code here println(myName) }
Using an if block:
if(myName!=null){ //execute code here println(myName) }
var myName:String? = null
Using safe call operator ?. and scoping function let:
myName?.let { //execute code here println(myName) }
Using an if block:
if(myName!=null){ //execute code here println(myName) }