Hello, I want to check in a text file, if there is a word, then to set the whole line of the file variable
var
found : boolean;
sl : TStringList;
i : integer;
begin
found := false;
sl := TStringList.Create;
try
sl.LoadFromFile(filename);
for line in sl do
if Pos('hello', line)<>0 then
begin
found := true;
break;
end;
finally
sl.Free;
end;
end;
but I get this error:
unit1.pas(412,11) Fatal: Syntax error, "THEN" expected but "(" found