Autor Beitrag
Brutzler
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Sa 23.04.05 18:56 
Hallo,
Habe versucht bei einer Repeat-Schleife die Bedingung, also 'until x:= y;' z.B. durch if zu erweitern. Folgendermassen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if CheckBox2.checked=true then
until x>= 5;
if CheckBox2.checked=false then
until x>= 8;


als Bsp.

Ich habe also versucht die Bedingung zur Schleifenbeendung durch das Klicken einer CheckBox zu veraendern. Wie kann ich das besser formulieren??

Vielen Dank im Vorraus
mfG

Brutzler

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
Moderiert von user profile iconChristian S.: Topic aus Sonstiges verschoben am Sa 23.04.2005 um 19:58
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 23.04.05 19:00 
Es müsste so heissen (oder ähnlich):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
repeat
 // ...
 if CheckBox2.Checked and (x >= 5) then
  break;
 if not CheckBox2.Checked and (x >= 8) then
  break;
until false;

Oder etwa so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
repeat
 // ...
until (CheckBox2.Checked and (x >= 5)) or 
      (not CheckBox2.Checked and (x >= 8));
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: Sa 23.04.05 19:00 
Wenn ich das richtig überblicke, sollte das so gehen:
ausblenden Delphi-Quelltext
1:
2:
3:
repeat
...
until ((x>=5) AND CheckBox2.checked) OR (x>=8));


Edit: Ich werd alt...zu langsam. Aber meine Abbruchbedingungen sind kürzer ;-)

_________________
We are, we were and will not be.
Brutzler Threadstarter
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Sa 23.04.05 19:06 
Funktioniert....
Danke