Results 1 to 12 of 12

Thread: Forwards...

  1. #1
    Join Date
    Apr 2007
    Location
    Here
    Posts
    109
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Forwards...

    I might be posting this in the wrong place, but I couldn't seem to find anything that explains what forwards are and how to use them or what they do.

    procedure SomeProcedure(SomeInt: integer); forward;

    What would this do I don't understand.

    Whom ever answers this for me gets ++rep!!!

  2. #2
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    that is so you can make the procedure later on in the script without it complaining that the procedure deosnt exist

    so if you have three procedures and one is inside the other then you can use a forward to stop any errors

    ~shut

    EDIT: if you run this then it will comeup with an error saying that number3 is an unknow indentifier
    thats because the procedure is after the one it is included in
    SCAR Code:
    program New;

    procedure number1;
    begin
      number3;
    end;

    procedure number2;
    begin
      number1;
    end;

    procedure number3;
    begin
      number2;
    end;

    begin
      number1;
    end.
    but if we add a forward to it then it will get rid of the error becuse it is baisically putting it where it is and above the first one
    SCAR Code:
    program New;

    procedure number3; forward;

    procedure number1;
    begin
      number3;
    end;

    procedure number2;
    begin
      number1;
    end;

    procedure number3;
    begin
      number2;
    end;

    begin
      number1;
    end.
    that would get rid of that error

  3. #3
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Well. It just forwards a procedure.

    Look at this example:

    SCAR Code:
    program ForwardsExample;

    procedure C; forward; // Try to remove it and see what happens?
    procedure A;
    begin
      C;
      WriteLn('A');
    end;

    procedure B;
    begin
      WriteLn('B');
    end;

    procedure C;
    begin
      A; // The "forward" allows us to call A IN C! WOOTS.
      WriteLn('C');
    end;

  4. #4
    Join Date
    Apr 2007
    Location
    Here
    Posts
    109
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey Shuttleu Nice to see you back first off, and second off THANKYOUSOMUCHOMGYOUROK!!! I really do appreciate it though lol... ++rep for you.

    Edit: Evil you get rep too for making me the example because now I really understand. Thanks mates!

  5. #5
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  6. #6
    Join Date
    Apr 2007
    Location
    Here
    Posts
    109
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  7. #7
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  8. #8
    Join Date
    Apr 2007
    Location
    Here
    Posts
    109
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Watch Billy Maddison and pee my pants while laughing, because you're not cool if you don't pee you pants...

  9. #9
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  10. #10
    Join Date
    Mar 2007
    Posts
    151
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Shuttleu View Post
    L-L-Link?

    ~shut
    <-- deserves a rep

    http://www.watch-movies.net/movies/billy_madison/

  11. #11
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by EvilChicken! View Post
    Well. It just forwards a procedure.

    Look at this example:

    SCAR Code:
    program ForwardsExample;

    procedure C; forward; // Try to remove it and see what happens?
    procedure A;
    begin
      C; {forward allows you to use C in A} //HyperSecret edit
      WriteLn('A');
    end;

    procedure B;
    begin
      WriteLn('B');
    end;

    procedure C;
    begin
      A; // The "forward" allows us to call A IN C! WOOTS. ^^
      WriteLn('C');
    end;
    lol evil, you mean the forward allows us to call C in A. A is declared before C so we can use A in C already.

    You use forward when one procedure needs to be used earlier in another function/procedure. Like these guys have posted.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  12. #12
    Join Date
    Aug 2008
    Location
    Serdia, Isla Prima
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanx for the explination guys, been having some issues with this and now I can just use forward

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
  •