-- Build with e.g., "gnatmake main.adb -gnat2020"
-- EMACS ADA MODE ISSUE: remove the 'commented out' Postcondition for
-- Absolute_Difference and the Ada Mode parser signals
-- all sorts of errors.
with Ada.Text_IO; use Ada.Text_IO;
procedure Main
is
procedure Absolute_Difference
(x, y : Integer;
diff : out Integer)
-- with Post => (declare
-- min : constant Integer := Integer'Min(x, y);
-- max : constant Integer := Integer'Max(x, y);
-- begin diff = max - min)
is
begin
diff := abs x - y;
end Absolute_Difference;
u : constant Integer := 95;
v : constant Integer := 5;
d : Integer;
begin
Absolute_Difference (u, v, diff => d);
Put_Line ("Absolute difference =" & d'Img); -- prints "90"
end Main;
--------- END OF EXAMPLE FILE main.adb