Kotlin has various types including strings, integers, floats, booleans, etc. Here are a few basic examples.
fun main() {
Strings, which can be added together with +.
+
println("kot" + "lin")
Integers and floats.
println(1 + 1)
println(7.0 / 3.0)
Booleans, with boolean operators as you’d expect.
println(true && false)
println(true || false)
println(!true)
}
$ kotlinc main.kt -include-runtime -d main.jar
$ java -jar Main.jar
kotlin
2
2.3333333333333335
false
true
by Ruben van Nieuwpoort | source | license | based on Go by Example