Built for the U.S. Department of Defense specifically to eliminate the kinds of bugs that cause catastrophic failures โ Ada is still mandated or heavily used in avionics, air-traffic control, railway signaling, and defense systems where a crash isn't an inconvenience, it's a disaster.
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line("Hello, world!");
end Hello;
Ada's defining feature โ you can define exactly what values are legal for a type, and the compiler enforces it. This is a huge part of why it's trusted for safety-critical code.
type Altitude is range 0 .. 45000; -- illegal values are a compile error, not a runtime bug
Cruise_Alt : Altitude := 35000;
if Age >= 18 then
Put_Line("Adult");
elsif Age >= 13 then
Put_Line("Teen");
else
Put_Line("Child");
end if;
for I in 1 .. 5 loop
Put_Line(Integer'Image(I));
end loop;
while N > 0 loop
Put_Line(Integer'Image(N));
N := N - 1;
end loop;
function Add(A, B : Integer) return Integer is
begin
return A + B;
end Add;
Ada's module system โ groups related types, procedures, and functions with a clean public/private separation.
package Geometry is
function Area(Width, Height : Float) return Float;
end Geometry;
package body Geometry is
function Area(Width, Height : Float) return Float is
begin
return Width * Height;
end Area;
end Geometry;