Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array with multiple types?

I was wondering if there is a way to make an array which would have multiple types of data fields.

So far I was using aMyArray: array of array [0..1] of TPoint;

But now, it is not enough for me. I need to add 3 more elements to the existing 2 "Point" elements making it an array like aMyArray: array of (TPoint,TPoint,real,real,real)

So each element of aMyArray would have 5 'children', 2 of which are of a TPoint type and 3 of them are 'real' type.

Is this possible to implement somehow?

like image 655
user1651105 Avatar asked Mar 06 '26 19:03

user1651105


1 Answers

Maybe a record like

TMyType = record
  Points: array[0..1] of TPoint;
  Floats: array[0..2] of Real;
end;

or

TMyType = record
  Point0: TPoint;
  Point1: TPoint;
  Float0: Real;
  Float1: Real;
  Float2: Real;
end;

works for you.

like image 52
Uli Gerhardt Avatar answered Mar 08 '26 17:03

Uli Gerhardt