Autor Beitrag
Smartie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 08:07 
Hallo,

mehrere Bedingungen in einer If-anweisung hab ich geschaft, es sieht grad so aus:

ausblenden Delphi-Quelltext
1:
If (Ort1= 'AA') and (Ort2= 'BB') then					


Aber, ich habe mehrere Solcher Anweisungen, und wenn ich die "einfach Hintereinanader" Abarbeite, dann führt er unweigerlich zu meiner Else-Anweisung, die Fehler in der Eingabe abfangen soll.

Gibt es soetwas wie ein "else if" wie ich es von Basic her kenne?


Lieben Gruß und Danke

Smartie
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 27.04.05 08:15 
user profile iconSmartie hat folgendes geschrieben:
Hallo,
Gibt es soetwas wie ein "else if" wie ich es von Basic her kenne?


Warum probierst dus nicht aus?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
If (Ort1= 'AA') 
then showmessage('Ort AA')
else if (Ort2= 'BB') 
     then showmessage('ort BB');


Mehrere Befehle im then oder else Block sind mit begin-end zu einzuschließen..
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 27.04.05 08:16 
Ja, das gibt es:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
If edingung Then
    Anweisung
else if Begindung Then
    Anweisung
else
    Anweisung;

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 27.04.05 08:50 
Tausend Dank,

ich hab verpeilt, die ";" rauszunehmen.

Lieben Gruß

Smartie