Re: What is wrong with this

Posted by webmaster Guido on March 23, 2001:

In Reply to: What is wrong with this posted by Percy on March 22, 2001:

: procedure addRecord (regNo : String; initialMileage : integer;
: initialFuelUsed : real);
: {Assumes the address book is not full, and there is no
: entry that already has Name as its name}
: begin
: Count := Count + 1;
: with MyBook[Count] do
: begin
: TheReg := regNo;
: Mileage := initialMileage;
: Fuel := initialFuelUsed;
: end;

: It wont work say evrything is incompatible and I dont know how to change it????
Probably you already know everything in the checklist below, but sometimes we overlook something obvious ;-)
You should check that:

** MyBook is an array of records, and the type declaration of this record type contains:
TheReg: string;
Mileage: integer;
Fuel: real;
** MyBook and Count are visible in the entire unit. Where are these variables declared?
** Count never becomes greater then the highest index that is allowed for MyBook. For example, if MyBook is declared as
MyBook: array[1..100] of TMyBook;
then make sure that Count never becomes greater than 100.

This are the most obvious things to check. If this doesn't solve the problem, give us some more details please.