Thread View: alt.comp.borland-delphi
3 messages
3 total messages
Started by Albert Truter
Mon, 12 Jan 2004 01:22
For loop to while loop convet
Author: Albert Truter
Date: Mon, 12 Jan 2004 01:22
Date: Mon, 12 Jan 2004 01:22
30 lines
2400 bytes
2400 bytes
Hey all you Delphi Guru's, please help.
I need to convert the following For loop to a nested while loop.
I send programe with as attachment.
Thanks
Albert
alberttruter@webmail.co.za
procedure TfrmLooping.btnloopClick(Sender: TObject);
var
sString : String;
jIndex. iIndex : Integer;
begin
sString := edtStringInitial.Text;
for iIndex := sedStartFirst.Value to sedEndFirst.Value Do
begin
for jIndex := sedStartSecond.Value to sedEndSecond.Value Do
Begin
sString := sString + IntToStr(iIndex) + IntToStr(jIndex);
end;
end;
edtStringOutput.Text := sString;
end;
end.
Re: For loop to while loop convet
Author: Nicolai Hansen
Date: Mon, 12 Jan 2004 09:49
Date: Mon, 12 Jan 2004 09:49
20 lines
1744 bytes
1744 bytes
procedure TfrmLooping.btnloopClick(Sender: TObject);
var
sString : String;
jIndex, iIndex : Integer;
begin
sString := edtStringInitial.Text;
iIndex:=sedStartFirst.Value;
while iIndex<=sedEndFirst.Value do
begin
jIndex:=sedStartSecond.Value;
while jIndex<=sedEndSecond.Value do
Begin
sString := sString + IntToStr(iIndex) + IntToStr(jIndex);
inc(jIndex);
end;
inc(iIndex);
end;
edtStringOutput.Text := sString;
end.
Re: For loop to while loop convet
Author: D. L. von Pontz
Date: Sat, 24 Jan 2004 00:51
Date: Sat, 24 Jan 2004 00:51
24 lines
2138 bytes
2138 bytes
Thanks! Inspiring to me, on how code oughta look! Nicolai Hansen wrote: > procedure TfrmLooping.btnloopClick(Sender: TObject); > var > sString : String; > jIndex, iIndex : Integer; > > begin > sString := edtStringInitial.Text; > iIndex:=sedStartFirst.Value; > while iIndex<=sedEndFirst.Value do > begin > jIndex:=sedStartSecond.Value; > while jIndex<=sedEndSecond.Value do > Begin > sString := sString + IntToStr(iIndex) + IntToStr(jIndex); > inc(jIndex); > end; > inc(iIndex); > end; > edtStringOutput.Text := sString; > end.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads