I don't understand why my linear search program in pascal is not working... Some help will be appreciated.
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
Type
TStudent = Record
Name : String[15];
End;
Var Name : array [0..3] of string=('Fred','Jack','Chris','Ali');
inputname : string;
n : integer;
begin
Name[0] := 'Fred';
Name[1] := 'Jack';
Name[2] := 'Chris';
Name[3] := 'Ali';
n := 0;
Writeln('Enter Name');Read(inputname);
repeat
If inputname = Name[n]
then
writeln(n)
else
n := n + 1;
until inputname = Name[n] ;
readln;
If n = 4
then
writeln('record not found');
readln;
end.