Return multiple values: Difference between revisions

Content added Content deleted
(add language: Retro)
(Added Delphi example)
Line 154: Line 154:
if accepted will allow nice tuple destructuring code like:
if accepted will allow nice tuple destructuring code like:
<lang d>(auto m1, m2) = addSub(33, 12);</lang>
<lang d>(auto m1, m2) = addSub(33, 12);</lang>


=={{header|Delphi}}==

Delphi functions return a single value, but var parameters of a function or procedure can be modified and act as return values.

<lang Delphi>program ReturnMultipleValues;

{$APPTYPE CONSOLE}

procedure GetTwoValues(var aParam1, aParam2: Integer);
begin
aParam1 := 100;
aParam2 := 200;
end;

var
x, y: Integer;
begin
GetTwoValues(x, y);
Writeln(x);
Writeln(y);
end.</lang>


=={{header|Factor}}==
=={{header|Factor}}==