pascalnide
pascalnide copied to clipboard
[lang] Optional parameters doesn't work
Today's Pascal —as being used by FPC and Delphi since ages ago— has default or optional parameter in function/procedure declaration. This kind of parameter can be omitted when calling the function. This doesn't work in Pascal N-IDE.
Example:
program test;
uses SysUtils;
// function f with p as optional parameter (has default value)
function f(p: integer = 0): string;
begin
if p = 0 then
f := 'zero'
else
f := intToStr(p);
end;
begin
f; // print 'zero'
f(2); // print '2'
end.
Reference: https://www.freepascal.org/docs-html/current/ref/refsu64.html#x176-19800014.4.1