Is there a shorthand syntax to create a record?
Posted on 2004-09-03
I need to pass a record as an argument to a function, and I have all the record fields as seperate variables. Is there an easy way to do this?
At the moment I am writing:
x, y : integer;
pt : TPoint;
<--- get x and y somehow --->
pt.x := x;
pt.y := y;
I'd quite like to be able to write something more like:
somePointFunction(TPoint(x: x; y: y));
but that doesn't compile.
Of course, it's not too much bother when the record has just two fields, but if it is a long record it can work out as a lot of code.
Thanks for your time,