Autor Beitrag
sky21
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 141

W7
D2010, XE2
BeitragVerfasst: Mi 08.03.06 12:42 
Angenommen eine Bedinung bei einer Kontrollstruktur ist erfüllt und jetzt sollte die Methode ('tschuldigung, 'precedure') vorzeitig verlassen werden. Wie lautet das Schlüsselwort dazu? (Ich aus der VC++ Welt kommend würde jetzt mit 'return;' herausspringen).

Thanks for the help on this
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TSomeObject.process;
begin
 if 5=5 then
  // how can I quit?
 else
  // otherwise...
 end;
end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
Querkopf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31

Win XP SP2
Turbo Delphi 2006 Explorer
BeitragVerfasst: Mi 08.03.06 12:45 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TSomeObject.process;
begin
 if 5=5 then
   exit
 else
  // otherwise...
 end;
end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
MisterBum83
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mi 08.03.06 13:02 
Ein bischen eleganter wäre:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TSomeObject.process;
begin
 if variable<>5 then
   do something;
end;


So macht er in der Procedure erst garnix und verlässt sie wieder.
Aber wie mein Vorgänger sagte, mit exit (ist unelegant) verlässt man eine Procedure.
sky21 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 141

W7
D2010, XE2
BeitragVerfasst: Mi 08.03.06 13:12 
hi. danke für die soforthilfe.