SRL Archive - OSR Help

What does "for Iter := 1 to 3 do" do?


Aidan

2006-10-29 19:26:30

Well i was looking through a script (Its how i learn) and i seen

procedure BankToMine;
begin
MouseFindFlag(637+random(5),44+random(5),1,-1);
Flag;
for Iter := 1 to 2 do
begin
RadialRoadWalk(RoadColor,60,120,70,2,2);
end;
for Iter := 1 to 3 do
begin
RadialRoadWalk(RoadColor,150,210,70,2,2);
end;
end;
I never understood the "for Iter := 1 to 3 do" bit. Could someone explain in some detail what it does. I understand all the RadialRoadWalk and stuff but not the "for Iter := 1 to 3 do" but.
Thanx in advanced,
Aidan;)

Ron

2006-10-29 19:34:07

Iter is a variable. And what you're asking about is a for statement.

you can do something like this with for statements if you like. :)


program New;
var
i : integer;
begin
for i := 1 to 100 do
begin
WriteLn(IntToStr(i));
end;
end.

This just means, for i being 1 to i being 100, do this. So each time it does everything from begin to end, it adds 1 to i, until i is 100.

~Ron

Aidan

2006-10-29 20:25:46

Thanx for help!!! I understand it know!! It just ike repeat untill(Iter = 3)

CamHart

2006-10-29 20:43:31

or while blah do :D Just a lot easier to use/work with

lardmaster

2006-10-29 21:01:40

it basically repeats the code while the variable is less than the second number. it increments by one each time the code is done.

Spky

2006-10-30 15:23:01

From: CamHart
or while blah do :D Just a lot easier to use/work with


No'rly

for I:= 0 to 99 do
Array[I]:= IntToStr(I);
while (I < 100) do
begin
Array[I]:= IntToStr(I);
I:= I + 1;
end;

2 lines or 5.. you choose :wink:.