[Lazarus] Compare record
Jürgen Hestermann
juergen.hestermann at gmx.de
Wed Mar 11 07:22:25 CET 2015
Am 2015-03-10 um 22:23 schrieb aradeonas:
> How can I compare two record?
> Like this :
> type
> TRec=record
> na:string;
> end;
>
> var
> R1,R2:TRec;
> Begin
> R1.na:='A';
> R2.na:='B';
>
> if R1<>R2 then
> Showmessage('Error')
In your example you would not need the record
if it consists of only one string component.
But you can write:
if R1.na<>R2.na then
Showmessage('Error')
In general there cannot be a standard
compare function for records because
you can have a lot of different types
within a record. So you need to write
your own compare function.
More information about the Lazarus
mailing list