![]() |
Anweisung für FOR-Variable
Hi,
ich hab ne normale FOR-Schleife und möchte innerhalb der Schleife die Schleifenvariable [i] erhören. Das geht aber nich ?
Delphi-Quellcode:
Weis da jemand was ?
for i := 1 to 100 do begin
if i = 50 then i := 70; end; devnull |
Re: Anweisung für FOR-Variable
Da musst Du auf eine while-Schleife ausweichen.
Delphi-Quellcode:
...:cat:...
I := 1;
while I <= 100 do begin if I = 50 then I := 70; Inc(I); end; |
Re: Anweisung für FOR-Variable
Richtig, das geht nicht. Zumindest nicht ohne schmutzige Tricks.
Aber eine for-Schleife ist ja extra dazu da, dass man sich nicht selbst um die Zählvariable kümmern muss. Was hast du denn vor? |
Re: Anweisung für FOR-Variable
Ich vermute mal, du möchtest den Bereich von 50 bis 70 überspringen, oder? Dann musst du wirklick eine While Schleife nehmen, wie Sakura (...:cat:...) schon sagte. :wink:
Man liest sich, Stanlay :hi: |
Re: Anweisung für FOR-Variable
Ich stell hier auch mal eine Frage ;)
Sie passt so gut hier her: Gibt es nicht sowas, wäre praktisch:
Delphi-Quellcode:
for (i:=1 to 50) and (i:=70 to 100) do
|
Re: Anweisung für FOR-Variable
Ok danke, die while-Schleife hat den Durchburch gebracht ...
Naja, ich versuche aus einer Zeile einzelne Information herauszunehmen:
Delphi-Quellcode:
So sieht die Zeile aus !
;;NAME;VERSION;SIZE;DESCRIPTION;LINK;
nochmal danke devnull |
Re: Anweisung für FOR-Variable
So was gibts:
Delphi-Quellcode:
:wink:
for i := 1 to 50 do //
for i := 70 to 100 do // |
Re: Anweisung für FOR-Variable
@Chewie: stimmt :wall:
War eine blöde Frage von mir. |
Re: Anweisung für FOR-Variable
@chewie
Schmutzige Tricks? Erläutere doch bitte ein bißchen weiter. Czapie |
Re: Anweisung für FOR-Variable
So gehts (in Assmebler):
Delphi-Quellcode:
...:cat:...
procedure TForm1.Button1Click(Sender: TObject);
var I: Integer; begin for I := 1 to 100 do begin asm cmp ebx, 50 jnz @@1 mov ebx, 70 @@1: end; ListBox1.Items.Add(IntToStr(I)); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:48 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz