home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!emory!sol.ctr.columbia.edu!hamblin.math.byu.edu!yvax.byu.edu!cunyvm!psuvm!f0o
- Newsgroups: comp.lang.pascal
- Subject: Comparing record types
- Message-ID: <92316.095144F0O@psuvm.psu.edu>
- From: <F0O@psuvm.psu.edu>
- Date: Wed, 11 Nov 1992 09:51:44 EST
- Organization: Penn State University
- Lines: 30
-
- Hi!
-
- Take a look at the following example program:
-
-
- Type
- TPoint = Record
- X, Y: Integer;
- End;
-
- Var
- P1, P2: TPoint;
-
-
- Begin
- P1.X := 10; P1.Y := 20;
- P2 := P1;
- If (P1 = P2) then Writeln('Equal'); { This line is incorrect }
- End.
-
- When I run the program, I get the message, 'Operand types do not
- match operator'.
- P1 and P2 are two variables of the same record type. Now you can
- directly assign one record to another, as long as they are the same type.
- If there some simple way to compare P1 and P2 to see if they are equal,
- without having to check each field for equality in my code?
- I was hoping I could say If (P1 = P2) then ..., but this does not
- work. Does anyone know of some trick so I can easily compare records?
-
- [Tim]
-