-
-
Save Y-E-P/a51e1fadc15fb30321f2c4cc84ddcb19 to your computer and use it in GitHub Desktop.
Example of takeIf function in Kotlin
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
val index = "Kotlin".indexOf('K').takeIf { it > 0 } ?: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment