Christoph's Blog about Digital Stuff

Kotlin

2020-02-23 22:13:00 +0200

Kotlin is a very interesting alternative to Java on the JVM. With many delightful features. Here are some examples:

fun main() {
	// 1. Type Inference
    var x = 1
    
	// 2. Assignment with Expression
    var value = when (x) {
        1 -> "one"
        2 -> "two"
        else -> "something"
    }
    // 3. String Interpolation
    println("Value is: ${value}")
}