> ^_^ Thats how its working at the moment and I've known that FPC doesn't
> do that kinda definition on the fly. My real question was why not?
Because Pascal is not a dynamically typed language. C/C++ doesn't do this
kind of thing either. Not 'on the fly' without any basic types defined.
Matt
^_^ Thats how its working at the moment and I've known that FPC doesn't
do that kinda definition on the fly. My real question was why not?
On Wed, 2004-02-18 at 21:34, Adam Victor Nazareth Brandizzi wrote:
> You can also define a function that returns the record you need:
>
> function NewMyRec(
You can also define a function that returns the record you need:
function NewMyRec( X, Y : double ) : TMyRec;
begin
NewMyRec.x := X;
NewMyRec.y := Y;
end;
I think it's really better than declare a new variable and initialize it
by the code.
if CheckPoint(NewMyRec(1.2, 2.2)) then ...
Be well
Since Free Pascal supports function overloading,
you could do something like this:
Function CheckPoint(X, Y:real): Boolean;
Begin
{Does something here..}
end;
Function CheckPoint(aPoint: tMyRec): Boolean;
Begin
Result:=CheckPoint(aPoint.X, aPoint.Y);
end;
// So you can use it either way: