-
-
Save ehsansouri23/cf801541ce562e8daf83d774fc0a6308 to your computer and use it in GitHub Desktop.
Kotlin null checking with let function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val address = findAddress() | |
address?.let { | |
println("$it is a valid address") | |
} ?: run { | |
println("address was null) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment