Results 1 to 6 of 6

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

  1. #1
    Join Date
    Oct 2006
    Location
    UK
    Posts
    78
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

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

    Well i was looking through a script (Its how i learn) and i seen
    Code:
    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

  2. #2
    Join Date
    Apr 2006
    Location
    I live in NH
    Posts
    611
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    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.

    SCAR Code:
    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

  3. #3
    Join Date
    Oct 2006
    Location
    UK
    Posts
    78
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  4. #4
    Join Date
    Oct 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  5. #5
    Join Date
    Sep 2006
    Location
    Scripter's Heaven
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

    And check out my pascal interpreter!
    <R0b0t1> No, really, I went to a bar and picked up a transvestite.

  6. #6
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by CamHart View Post
    or while blah do Just a lot easier to use/work with
    No'rly

    Code:
    for I:= 0 to 99 do
     Array[I]:= IntToStr(I);
    Code:
    while (I < 100) do
     begin
      Array[I]:= IntToStr(I);
      I:= I + 1;
     end;
    2 lines or 5.. you choose :wink:.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 05-17-2008, 12:48 PM
  2. action="www.site.com" method="post"
    By Jason2gs in forum General
    Replies: 4
    Last Post: 05-17-2007, 11:50 PM
  3. Replies: 3
    Last Post: 04-19-2007, 03:44 AM
  4. Replies: 5
    Last Post: 10-26-2006, 11:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •