Results 1 to 6 of 6

Thread: GoTo?

  1. #1
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default GoTo?

    Sorry for so many threads but this is helping greatly. When I am done with this script I will start my RS script. Anyway, is there a way to go back to part of a procedure and do it again a certain amount of times?

  2. #2
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    repeat
    .....
    ....
    until

    example:
    SCAR Code:
    Procedure Example;
    var
     c:integer;
    begin
      c:=0;
     repeat
      writeln('this is an example');
      c:=c+1
     until(c>5)
    end;

    Think I forgot an end/begin but you get the point
    Last edited by Bebe; 05-13-2010 at 05:42 AM.

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Bebe, you were correct.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    I think he meant using labels. But those are generally discouraged and loops should sort you out well enough

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    I think he meant using labels. But those are generally discouraged and loops should sort you out well enough

    ~RM
    why are they discouraged? if used correctly, they are really good in fail safes

    also if you mean label(it would be best to use repeat or while-do in this case),

    SCAR Code:
    var
      c : integer;
    label
      here;
    begin
      here:
      writeln('hello');
      inc(c);
      if c >= 5 then exit;
      if not this then goto here;
    end.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Nah; Use this as fail safe!

    pascal Code:
    program new;
    procedure testme(value : boolean);
    var
      bool : boolean;
    begin
      try
        bool := value;
        Writeln('bool = ' + booltostr(bool));
        if bool then
        begin
          Writeln('Bool was true, lets exit!');
          exit;
        end;
        Writeln('Bool was not true..');
      finally
        Writeln('We catched the exit!');
      end;
    end;
    begin
      testme(true);
      testme(false);
    end.
    Verrekte Koekwous

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
  •