Kotlin cheatsheet
Published 5 months ago: August 22, 2020
Cheatsheet for Kotlin
This cheatsheet is a small collection of handy snippets for quick reference in tricky situations. Feel free to suggest edits, propose additions, complain about something, disagree with content or such and the like. Every feedback is a welcome one.
Create a function
fun main() { // 2
println("Hello, World!") // 3
}
Print to console
// Print with newline, I.E. move cursor to new line.
println("Hello Werldz!")
// Print without adding newline
print("Enter text: ")
Prompt for input and print to console
print("Enter text: ")
val stringInput = readLine()!!
println("You entered: $stringInput")