Ada

Ada

Installation

Ubuntu
apt install gnat-{version}
Alma Linux
dnf install gcc-gnat
Arch Linux
pacman -S gcc-ada

Examples

Fibonacci Numbers
-- Fibonacci Numbers
with
    Ada.Integer_Text_IO,
    Ada.Command_Line;

use
    Ada.Integer_Text_IO,
    Ada.Command_Line;

procedure fib_ada is
    N : Integer := Integer'value(Argument(1));

begin
    declare
        function fib (n : Integer) return Integer is
        begin
            if n < 2 then
                return n;
            else
                return fib(n - 2) + fib(n - 1);
            end if;
        end fib;

    begin
        Put(fib(N), 1);
    end;
end fib_ada;

-- example
--  compile
--      gnatmake -O3 fib_ada.adb