Autor Beitrag
xus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: So 27.05.07 12:22 
hi!

ich habe ein kleines problem.
ich komm mit if und else noch nicht ganz zurecht!

hab ich das jetzt richtig verstanden wenn ich eine code in der form

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if 1=1 then
action
//aber ich kann hier keine 2 action einbaun?

else if....


und nocheine frage:

ich möchte bei if 2 abfragen einbaun und hab es probiert sie mit and zu verknüpfen.. klappt aber nicht.
schaut so aus

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm3.Button4Click(Sender: TObject);
begin
//zahl:=random(37);

//if zahl=0 then label2.caption:='Ergebnis: ' + inttostr(Zahl) + ' Grün You have lost!'

//else
//if zahl < 18 and zahl mod(2)=0 then label2.caption:='Ergebnis: ' + inttostr(Zahl) + ' Rot You have won!'

//else
//if zahl < 18 and zahl mod(2)<>0 then label2.caption:='Ergebnis: ' + inttostr(Zahl) + ' Schwarz You have won!'

//else
//if zahl > 18 and zahl mod(2)=0 then label2.caption:='Ergebnis: ' + inttostr(Zahl) + ' Rot You have lost!'

//else
//if zahl > 18 and zahl mod(2)<>0 then label2.caption:='Ergebnis: ' + inttostr(Zahl) + ' Schwarz You have lost!!';


was müsste ich hier genau machen, damit es klappt?

mfg XuS

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 27.05.07 12:24 
Hallo,

bitte erstelle für jede deiner Fragen ein separates Topic, da die Diskussion mehrerer Fragen in einem Topic für gewöhnlich für Verwirrung und Durcheinander sorgt.

Wähle für Deine Threads außerdem Titel, die etwas über die Frage aussagen.

Viele Grüße,
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.