with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Text_IO; use Ada.Text_IO; procedure functionRecords 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; -- Adds two pairs to produce a new pair -- Overloads the operator plus with an additional meaning -- Returns a pair -- Can you write this function with only one statement? 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 := (2, 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 functionRecords; -- Output -- 3 6 -- 2 4 -- Same