Ich lerne gerade etwas Pascal und stehe vor meinem ersten Problem, welches ich mal nicht mit Referenzen ect.. gelöst bekomme.
Und zwar bekomme ich bei einer einfachen If abfrage ob der Stringinhalt = '1' ist einen Error: Illegal expression angezeigt. Auch ein AnsiContainsText(exTmp,'1') bringt den gleichen fehler. Eventuell hilft es ja meinen Denkfehler zu erklären, das ich vorher eher in QB und VB Programmiert habe und da hatte ich bei einer einfachen if abfrage so nie Probleme gehabt wenn die Typen passten.
Nun meine Frage wieso? Habe ich eventuell das Problem zwei unterschiedliche Typen vergleichen zu wollen? Ich dachte bisher beides ist vom Typ String. Und vorallem was bedeutet Illegal expression genau?
Ich hoffe mir kann hier wer eventuell helfen

Gruß DOS
Code: Alles auswählen
var
var myFile : TextFile;
var exTmp : String;
Za1, Za2, Za3, Za4, Za5, Za6, Za7, Za8, Za9, Za10 : String;
exZc1, exZc2, exZc3 : Boolean;
begin
assignfile(myFile,eFile);
reset(myFile);
ReadLn(myFile,Za1);
ReadLn(myFile,Za2);
ReadLn(myFile,Za3);
ReadLn(myFile,Za4);
ReadLn(myFile,Za5);
ReadLn(myFile,Za6);
ReadLn(myFile,Za7);
ReadLn(myFile,Za8);
ReadLn(myFile,Za9);
ReadLn(myFile,Za10);
ReadLn(myFile,exTmp);
CloseFile(myFile);
If exTmp = '1' Then exZc1 = True; else exZc1 = false;
end;
Code: Alles auswählen
Hint: (11030) Start of reading config file C:\lazarus\fpc\3.0.2\bin\x86_64-win64\fpc.cfg
Hint: (11031) End of reading config file C:\lazarus\fpc\3.0.2\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 3.0.2 [2017/02/27] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
(1002) Target OS: Win64 for x64
(3104) Compiling projekt1.lpr
(3104) Compiling unit1.pas
(3104) Compiling unit1.pas
(3104) Compiling unit3.pas
C:\fpc\unit3.pas(23,26) Hint: (5024) Parameter "Sender" not used
C:\fpc\unit3.pas(24,24) Hint: (5024) Parameter "Sender" not used
C:\fpc\unit3.pas(86,38) Error: (3203) Illegal expression
unit3.pas(125) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus\fpc\3.0.2\bin\x86_64-win64\ppcx64.exe returned an error exitcode