Nim is a statically typed, compiled systems programming language that combines successful concepts from Python, Ada, and Modula.

How to test

Prerequisites: Nim compiler

  • Ubuntu/Debian: sudo apt install nim
  • macOS: brew install nim
  • All platforms: https://nim-lang.org/install.html
nim c -r fibonacci.nim

Expected output:

0
1
1
2
3
5
8
13
21
34

Source Code

var a = 0
var b = 1
for _ in 0 ..< 10:
    echo a
    let c = a + b
    a = b
    b = c

Local Testing Screenshot Image