alors il y a une grosse différence entre une variable "array of" et un paramètre "array of".
le premier est un tableau dynamique, le second un tableau ouvert.
la nuance est subtile, mais elle est bien là comme illustré ci-dessous:
1 2 3 4 5 6 7 8 9 10 11 12
|
procedure test(a:array of string);
var
b: array of string;
begin
SetLength(a, 10); // impossible !
SetLength(b, 10); // autorisé
end;
begin
test(['a','b']);
end; |
or le tableau ouvert n'a qu'une dimension; tu ne peux déclarer
test([['a','b'],['c','d']]);
et tu ne peux déclarer un array of array...sauf si l'un ou les deux array sont dynamiques :
1 2 3 4 5
|
type
aastring = array of array of string; // dynamique
function test(a:aastring); |
Partager