Kotlin Programming Language

notes and observations about Kotlin Programming Language

Created: by Pradeep Gowda Updated: Oct 25, 2022 Tagged: kotlin · java

Reading

For the Pythonista

Kotlin uses >>> as the prompt for it’s REPL. This is nice and familiar for a Pythonista.

Looping

This program in Python

fruits = ['apple', 'orange', 'banana']
for i, f in fruits:
    print(f'{i+1}\t{f}')

in Kotlin becomes:

val fruits = listOf("hello", "world", "apple")
for ((i, f) in fruits.withIndex()) {
    println("${i+1}\t${f}")
}

A lot more () and {}, I know.