counter := Succ(counter);
end;
end
The difference between this construction and the for...to statement is that the while loop reevaluates
finalValue before
each iteration. This can result in noticeably slower performance if
finalValue is a complex expression, and it also
means that changes to the value of
finalValue within
statement can affect execution of the loop.
Examples of for statements:
for I := 2 to 63 do
if Data[I] > Max then
Max := Data[I];
for I := ListBox1.Items.Count - 1 downto 0 do
ListBox1.Items[I] := UpperCase(ListBox1.Items[I]);
for I := 1 to 10 do
for J := 1 to 10 do
begin
X := 0;
for K := 1 to 10 do
X := X + Mat1[I,K] * Mat2[K,J];
Mat[I,J] := X;
end;
for C := Red to Blue do Check(C);
Dostları ilə paylaş: