Home > Net >  Is it possible to have an array parameter with a default value?
Is it possible to have an array parameter with a default value?

Time:09-22

With the latest version of Delphi, is it possible to have an array parameter with a default value?

procedure myProcedure(const AnArray: Tarray<integer> = [1,2,3]);

CodePudding user response:

Default parameters have to be constant expressions, as stated in the documentation. And constant expressions cannot represent non-empty arrays.

  • Related