Skip to content

Instantly share code, notes, and snippets.

@mirokolodii
Created October 18, 2019 06:35
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 mirokolodii/a24a5b8f6849d2104fa003bd5eca826e to your computer and use it in GitHub Desktop.
Save mirokolodii/a24a5b8f6849d2104fa003bd5eca826e to your computer and use it in GitHub Desktop.
Switch to Kotlin #2.5
var nullableStr: String? = null
var nonNullStr: String = "a string"
nullableStr = nonNullStr // valid
nonNullStr = nullableStr // error, should be checked for nullability first
If (nullableStr != null) {
nonNullStr = nullableStr // valid
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment