pascalabcnet/TestSuite/CompilationSamples/FuncParams.pas

12 lines
245 B
ObjectPascal
Raw Permalink Normal View History

// Переменное число параметров
2015-05-14 22:35:07 +03:00
function Sum(params arg: array of integer): integer;
begin
Result := 0;
foreach x: integer in arg do
Result += x;
end;
begin
writeln(Sum(1,2,3));
writeln(Sum(4,5,6,7));
end.