What is the best/least painful way to prepopulate a 2 dimensional integer array?
This compiles, but generates a type mismatch at runtime:
Simba Code:
program new;
var
IA: T2DIntegerArray;
begin
IA := [
[0, 1, 2],
[3, 4, 5]
];
end.
This works, but could get awkward with long lists:
Simba Code:
program new;
var
IA: T2DIntegerArray;
begin
SetLength(IA, 2);
IA[0] := [0, 1, 2];
IA[1] := [3, 4, 5];
end.
Toyed with the idea of just one huge integer array, given that the subarray has a fixed length.
Also considered stuffing each subarray into a string and store in TStringArray, which could be further condensed with Implode, but there is no good routine to put the integer array into a string or tstringarray.
There has to be a good way to do this?