Kotlin is a modern, statically typed programming language from JetBrains that targets the JVM, Android, JavaScript, and native platforms.

How to test

Prerequisites: Kotlin

  • Ubuntu/Debian: sudo apt install kotlin
  • macOS: brew install kotlin
  • All platforms: https://kotlinlang.org/docs/command-line.html
kotlinc -script fibonacci.kts

Expected output:

0
1
1
2
3
5
8
13
21
34

Source Code

var a = 0
var b = 1
repeat(10) {
    println(a)
    val c = a + b
    a = b
    b = c
}

Local Testing Screenshot Image