with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Text_IO; use Ada.Text_IO;
procedure tryRecords2 is
type Pair is record
x: Integer;
y: Integer;
end record;
procedure putPair(p: Pair) is
begin
put(p.x);
put(p.y);
new_line;
end putPair;
-- Return a pair
function "+"(a, b: Pair) return Pair is
answer: Pair;
begin
answer.x := a.x + b.x;
answer.y := a.y + b.y;
return answer;
end "+";
p1: Pair := (1, 2);
p2: Pair := (3, 4);
p3: Pair;
begin
p3 := "+"(p1, p2);
putPair(p3);
p1 := p1 + p1;
putPair(p1);
if p1 = p2 then
put_line("Same");
else
put_line("Different");
end if;
end tryRecords2;
-- OUTPUT
4 6
2 4
Different