Here it is the Hello World in ADA.
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, world!");
end Hello;
In the following listing you will find use of control structures in ADA
while a /= b loop
Ada.Text_IO.Put_Line ("Waiting");
end loop;
if a > b then
Ada.Text_IO.Put_Line ("Condition met");
else
Ada.Text_IO.Put_Line ("Condition not met");
end if;
for i in 1 .. 10 loop
Ada.Text_IO.Put ("Iteration: ");
Ada.Text_IO.Put (i);
Ada.Text_IO.Put_Line;
end loop;
loop
a := a + 1;
exit when a = 10;
end loop;
case i is
when 1 => Ada.Text_IO.Put("one");
when 2 => Ada.Text_IO.Put("two");
end case;
And now "Packages, procedures and functions".
Ada programs consist of packages, procedures and functions.
with Ada.Text_IO;
package Mine is
type Integer is range 1 .. 11;
i : Integer := Integer'First;
procedure Print (j: in out Integer) is
function Next (k: in Integer) return Integer is
begin
return k + 1;
end Next;
begin
Ada.Text_IO.Put_Line ('The total is: ', j);
j := Next (j);
end Print;
begin
while i < Integer'Last loop
Print (i);
end loop;
end Mine;