Created
March 2, 2023 06:57
-
-
Save akshaykalola28/2f51701a90a8149e23776b748c67ec47 to your computer and use it in GitHub Desktop.
Extension function for Run block ifNull
This file contains 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
fun Any?.ifNull(block: () -> Unit) = run { | |
if (this == null) { | |
block() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment