check null in kotlin code example
Example 1: kotlin is null or empty
// If we do not care about the possibility of getting spaces only...
if (number.isNullOrEmpty()) {
// alerts the user to fill in their number!
}
// when we need to block the user from inputting spaces only
if (name.isNullOrBlank()) {
// alerts the user to fill in their name!
}
Example 2: null check in kotlin
if(a != null) {
//do something
}