Kotlin

字数 153 · 2021-03-24

Hello

1
2
3
fun main() {
  println("Hello World")
}

Variables

read-only local variables are defined using the keyword val:

1
val a: Int = 1

variables that can be reassigned use the var keyword:

1
var x = 5

Classes

1
class Shape

StringTemplates

1
2
var a = 1
val s1 = "${s1.replace("is", "was")}, but now is $a"

Loop