Skip to content

Instantly share code, notes, and snippets.

@Audhil
Created February 27, 2020 09:55
Show Gist options
  • Save Audhil/3fcff05971161f978967c0bea490859f to your computer and use it in GitHub Desktop.
Save Audhil/3fcff05971161f978967c0bea490859f to your computer and use it in GitHub Desktop.
kotlin scope function
fun main() {
val valueIs = "Jack and jill went up the hill!"
val result = with(valueIs) {
this.contains("yup")
}
println(valueIs) // o/p - Jack and jill went up the hill!
println(result) // o/p - false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment