Autor Beitrag
Xearox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260
Erhaltene Danke: 3



BeitragVerfasst: Mi 03.02.10 09:35 
Es geht darum, das ich im meinem Programm gerne in einer IF THEN Bedingung 2 Hash werte miteinander vergleichen will...
Jedoch sind die Hash Werte Strings und in einer IF THEN kann ich keine zwei Strings mit dem Operator '=' vergleichen...

Wie muss ich das sonst machen?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 03.02.10 09:43 
Zeig mal deinen Code. Auch zwei Strings kann man per = vergleichen. Ich vermute, dass da Klammern in der Anweisung fehlen, weswegen der Compiler dann meckert.

_________________
We are, we were and will not be.
Xearox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260
Erhaltene Danke: 3



BeitragVerfasst: Mi 03.02.10 09:48 
oops, ich muss mich korregieren, ich benutze While Do

ausblenden Delphi-Quelltext
1:
while not (Edit1.Text) = (Hash) do					
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Mi 03.02.10 09:50 
user profile iconXearox hat folgendes geschrieben Zum zitierten Posting springen:
oops, ich muss mich korregieren, ich benutze While Do

ausblenden Delphi-Quelltext
1:
while not (Edit1.Text) = (Hash) do					


ausblenden Delphi-Quelltext
1:
while not (Edit1.Text = Hash) do					

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)
Xearox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260
Erhaltene Danke: 3



BeitragVerfasst: Mi 03.02.10 09:57 
wieso geht das manchmal ohne klammern und nur manchmal mit?
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Mi 03.02.10 10:08 
Wenn das "NOT" nicht da wäre, würde es ohne die Klammer gehen.

Das NOT kannst Du ja nur auf einen Boolschen Wert (True oder False) anwenden. Wenn nun die Klammer nicht dort stünde, würde erst mal not Edit1.Text ausgewertet. Da Edit1.Text aber ein String ist, kann darauf nicht das NOT angewendet werden -> Fehler.

Mit der Klammer wird zuerst der Ausdruckt in der Klammer ausgewertet:
(Edit1.Text = Hash) ergibt True oder False. Und darauf kann man wunderbar das NOT anwenden.

Hoffe, das war verständlich.

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)