Autor Beitrag
Green
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 18.09.05 12:32 
Also ich würde gern in einem if then gerüst zwei aussagen überprüfen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if x=15 UND y=60 then
begin
bla blubber
end;


gibts da ne möglichkeit? Würde mich über schnelle antworten freuen... :D

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: So 18.09.05 12:33 
Klar:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if x=15 and y=60 then
begin
bla blubber
end;



Gruß,
raziel

_________________
JSXGraph
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: So 18.09.05 12:35 
ausblenden Delphi-Quelltext
1:
if (x = 15) and (y = 60) then					

Die if-Abfrage prüft nur auf boolsche Werte, mit x=15 bildest du einen solchen. Mehrere beliebige boolsche WErte lassen sich mit and, or und not beliebig kombinieren. Und wegen Operator-Vorrang (vollständige Tabelle siehe Delphi-Hilfe) müssen noch Klammern drum.

Moderiert von user profile iconGausi: Delphi-Tags repariert.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
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: So 18.09.05 12:35 
Aber bitte mit Klammern!
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if (x=15) and (y=60) then
begin
bla blubber
end;


Uups...zu langsam.

_________________
We are, we were and will not be.
Green Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 18.09.05 12:39 
@Razie: Danke für die scnelle antwort aber irgendwie klappts nich...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if minuten=0 and sekunden=60 then
begin
  minuten:=60;
  stunden:=stunden-1;
end;


so bringt er fehlermeldung: inkompatible typen...

kapier ich nicht

Danke schonmal :D

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt
Green Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 18.09.05 12:42 
oh jetzt war ich zu langsam... :oops: gut danke für die antworten jetzt funzts

THNX :D (Des Forum hier is geil... hab die frabe vor 3 oder 4 minuten gepostet und jetzt schon so viele Antworten... einfach toll!!! :lol: :flehan: :mrgreen: )
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 18.09.05 12:43 
Hi!

"Inkompatible Typen" lässt für mich den Schluss zu, dass es sich bei "minuten" und "sekunden" nicht um Integer-, sondern um andere on-numerische-Varibalen handelt.
Falls es sich um String-Variablen handelt, müsstest du die Vergleiche auch mit Zeichenketten durchführen:
ausblenden Delphi-Quelltext
1:
if (minuten='0') and (sekunden='60') then					


Wie oben schon gesagt: Klammern nicht vergessen!

Alstar

//EDIT: Mhff. Zu langsam
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: So 18.09.05 12:46 
user profile iconAlstar hat folgendes geschrieben:
"Inkompatible Typen" lässt für mich den Schluss zu, dass es sich bei "minuten" und "sekunden" nicht um Integer-, sondern um andere on-numerische-Varibalen handelt.
Doch, handelt es sich, aber da and und or höherrangig sind als = und <> wird erst ein boolscher Wert draus und anschließend wird er mit einem Integer verglichen. Deswegen die Klammern. Nicht alles, was ein inkompatibler Typ ist, ist falsch deklariert ;-)

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert