Skip to content

Instantly share code, notes, and snippets.

@shinhyo
Last active February 19, 2020 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinhyo/ca0744ce5daeb6488845a7cbb77dd431 to your computer and use it in GitHub Desktop.
Save shinhyo/ca0744ce5daeb6488845a7cbb77dd431 to your computer and use it in GitHub Desktop.
with, run, let, also
val s: String? = "1"
val r: Int = with(s) { Integer.parseInt("${s?.length}") }
val r1: Int? = s?.run { Integer.parseInt("$length") }
val r2: Int? = s?.let { s -> Integer.parseInt("${s.length}") }
val r3: String? = s?.also { Integer.parseInt(it) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment