Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kotlin 101#1

Kotlin 101#1

WeRockStar

July 22, 2017
Tweet

More Decks by WeRockStar

Other Decks in Programming

Transcript

  1. @werockstar Tools - IntelliJ IDEA - Eclipse - Android Studio

    - try.kotlinlang.org - Interactive shell (REPL)
  2. @werockstar Declare a variable val kotlinString: String // Immutable var

    kotlinInt: Int // Mutable Recommend: declare all variable in Kotlin with val. var only necessary. Using immutable references, objects and functions without side effects.
  3. @werockstar String templates val kotlin = "Kotlin" val java =

    "Java" println("Using $kotlin without $java”) // println("Using ${kotlin} without ${java}”)
  4. @werockstar Null safety Safe Calls: "?." Elvis Operator: "?:" Safe-cast:

    "as?" Not-null assertions: "!!" function: ".let" Late-initialized properties: "lateinit" By default, all type parameters of functions and classes in Kotlin are nullable