kotlin은 데이터 타입을 추론하는 쇼pe inference기능을 갖고 있다.
var customers = 10
customers = 8
customers = customers + 3
+=, -=, *=, /=, %=
사용 가능하다.basic types
Category | Basic Types |
---|---|
Integers | Byte, Short, Int, Long |
Floating-point numbers | Float, Double |
Booleans | Boolean |
Characters | Char |
Strings | String |
val d: Int
d = 3
val e: String="hello"
println(d)
println(e)
:
를 사용해서 타입을 표시해줘야 한다.