Results 1 to 11 of 11

Thread: Another Question

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

    Default Another Question

    I want to have my script repeat somthing 6 times. Could i use a varaible and have it repeat until the varible was equal to 6 or is there a more effictive way? If i was to use a varaible how would i do this
    ? Thanks.

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Yea, I usually do that

    SCAR Code:
    repeat
    i:=i+1;
    dosomething
    until i=6;

    for also works just as well in this situation, (however I think that repeat is more flexible in other situations)

  3. #3
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    for i := 1 to 6 do
    //action block here
    (The 6 might need to be 7.)


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

  4. #4
    Join Date
    Oct 2006
    Location
    Philadelphia
    Posts
    75
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ok thanks guys.
    I have another question what does indentifier expected mean?

  5. #5
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    You probaly have not have Enough End; (s)

  6. #6
    Join Date
    Oct 2006
    Location
    Philadelphia
    Posts
    75
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    ok, thanks

  7. #7
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by I Pick Axes View Post
    (The 6 might need to be 7.)
    Can you explain to me what you mean by there might need to be 7?
    And I is just a variable you use right? it can be any other letter instead of I?
    ~jR

  8. #8
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Counting starts from 0

    So..

    it can be 7 or 6 ( Not sure lol )


    ~Home

  9. #9
    Join Date
    Aug 2006
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    program New;
    var i :integer;

    procedure lala;
    begin;
    for i := 1 to 6 do
    Writeln('lol')
    end;

    begin
    lala;
    end.

    That will repeat, writeln('lol') six times

  10. #10
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Junior View Post
    Can you explain to me what you mean by there might need to be 7?
    And I is just a variable you use right? it can be any other letter instead of I?
    ~jR
    I meant that I believed that the iterations go from the first number to the second inclusive, but that if I was wrong it would be exclusive the second number and you'd have to use from i to j+1 to get j-i iterations.


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

  11. #11
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    ok ok, so see how many times it repeats, try this

    Code:
    for f:=0 to 6 do
     writeln('f = '+inttostr(f))
    it doesnt have to be f, it can be any integer variable.
    and for loops can start from anywhere, it can be for f:=10 to 60 do
    Join the Official SRL IRC channel. Learn how to Here.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. i has a question
    By Solkrieg in forum OSR Help
    Replies: 5
    Last Post: 10-30-2008, 08:20 AM
  2. tab 5 question
    By dvdcrayola in forum OSR Help
    Replies: 4
    Last Post: 07-04-2008, 06:43 AM

Posting Permissions

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