Task

Show how to return more than one value from a function.




$ include "seed7_05.s7i";
 
const proc: sumAndDiff (in integer: x, in integer: y, inout integer: sum, inout integer: diff) is func
  begin
    sum := x + y;
    diff := x - y;
 end func;
 
const proc: main is func
  local
    var integer: sum is 0;
    var integer: diff is 0;
  begin
    sumAndDiff(5, 3, sum, diff);
    writeln("Sum: " <& sum);
    writeln("Diff: " <& diff);
  end func;