[ok] is it possible to default value for a parameter of type 'array of const' ? lazarus / 61-Beginners ---------------------------------------------------------------------- CapelliC · 2020-10-15 10:13 Since I use frequently the following pattern, I wonder if is there a way to declare a default value for a parameter of type 'array of const' as empty: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program x_array_of_const_default; uses SysUtils; {$if 0}procedure test(const msg: string);begin  writeln(msg)end;procedure test(const msg: string; const args: array of const);begin  test(format(msg, args))end;{$else}procedure test(const msg: string; const args: array of const = []);begin  writeln(format(msg, args))end;{$endif}begin  test('hello %s!', ['world']);  test('hello all!')end.   I realize could be impossible to avoid the error message (x_array_of_const_default.lpr(15,62) Fatal: Syntax error, ")" expected but "=" found), but I'd like to know from more knowledgeable people... Thanks, Carlo ---------------------------------------------------------------------- egsuh · 2020-10-15 10:46 Well you have to use overload, I guess. ---------------------------------------------------------------------- Thaddy · 2020-10-15 12:35 varargs misuse will do that. ---------------------------------------------------------------------- jamie · 2020-10-19 16:04 That would be a nice feature.. but not sure exactly how that would look in a complex manner. (a:Arary of const = ['hi',45,23,'done']); (:a:array of byte = [1,2,3,4]; Maybe we'll see this in the future ---------------------------------------------------------------------- PascalDragon · 2020-10-20 08:02 Quote from: CapelliC on October 15, 2020, 12:13:20 pmSince I use frequently the following pattern, I wonder if is there a way to declare a default value for a parameter of type 'array of const' as empty: No, there is not. ---------------------------------------------------------------------- CapelliC · 2020-10-27 15:11 Thanks you all for your answers. Appreciated.