Elixir is a dynamic, functional language built on the Erlang VM. It is designed for building scalable and maintainable applications.

How to test

Prerequisites: Elixir

  • Ubuntu/Debian: sudo apt install elixir
  • macOS: brew install elixir
elixir fibonacci.exs

Expected output:

0
1
1
2
3
5
8
13
21
34

Source Code

defmodule Fibonacci do
  def run(n) do
    Stream.unfold({0, 1}, fn {a, b} -> {a, {b, a + b}} end)
    |> Enum.take(n)
    |> Enum.each(&IO.puts/1)
  end
end

Fibonacci.run(10)

Local Testing Screenshot Image