Results 1 to 6 of 6

Thread: Very quick loop Question

  1. #1
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Very quick loop Question

    What do i use to end a repeat loop?
    Thanks

    Edit: also
    Im running this in simba
    SCAR Code:
    program new;
    {.include SRL/SRL.scar}
    Var I:Integer;
    begin
    SetupSRL;
    MarkTime(I);
    Wait(50);
    TimeFromMark(I)
    writeln(IntToStr(I));
    end.
    But getting really high numbers, im trying to get it to retrun around 50

    Thanks again
    Last edited by rya; 06-30-2010 at 04:06 PM.
    I see Now, says the blind man

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    TimeFromMark returns the time that has passed, so use it like: I := TimeFromMark(I);

    The I is the time the mark was set.
    There used to be something meaningful here.

  3. #3
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    HTML Code:
    var donevar := false;
    
    repeat
      if(allesklaarIs) then
        donevar := true;
      if(IetsFoutGaat) then
        break;
    until(donevar);
    Here you have 2 ways to get out of a repeat loop. break and changing the variable in until.

  4. #4
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    You could make a loop like this:
    SCAR Code:
    program new;
    {$I SRL/SRL.scar}

    var I: Integer;

    begin
      SetupSRL;
      MarkTime(I);
      repeat
        Wait(50);
        Writeln(IntToStr(TimeFromMark(I)));
      until(TimeFromMark(I) >= 300);
    end.
    There used to be something meaningful here.

  5. #5
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks break is what i was looking for
    thanks
    I see Now, says the blind man

  6. #6
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Break will break the loop and Exit will exit the function. Should be pretty self-explanatory.

    Just for more information on the subject
    There used to be something meaningful here.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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