Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Created July 7, 2017 04:56
Show Gist options
  • Save AkshayChordiya/eddd4ac0fc3d557852f0a1a8d1a51cdb to your computer and use it in GitHub Desktop.
Save AkshayChordiya/eddd4ac0fc3d557852f0a1a8d1a51cdb to your computer and use it in GitHub Desktop.
Example of takeUnless function in Kotlin
val index = "Kotlin".indexOf('K').takeUnless { it < 0 } ?: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment