how to init an array like
TMyArray = array[1..2, 1..3] of Integer;
I tried
MyArray : TMyArray;
MyArray = ( (1,2,3), (3,4,5) );
But did not have any luck with this style ...
You can initialise a typed constant as part of its declaration:
const
MyArrayConst: TMyArray = (
(1, 2, 3),
(3, 4, 5)
);
Or you can initialise a global variable in this way.
But you cannot initialise a local variable in that fashion. You could declare the constant, and then assign it to your variable.
var
MyArray: TMyArray;
....
MyArray := MyArrayConst;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With