Results 1 to 5 of 5

Thread: Variables

  1. #1
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Variables

    I don't think this is in a tutorial, so I'll ask it here.

    Do variable values from one procedure save over to another procedure if they are declared globally?
    Active only during the Summer...

  2. #2
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    yeah, if they are declared globally, every function can acces them even different threads can acces them
    Infractions, reputation, reflection, the dark side of scripting, they are.

  3. #3
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So if in one procedure I said x:=5 then 5 procedures later it would still be 5 assuming no other function changed it?
    Active only during the Summer...

  4. #4
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    yeah
    SCAR Code:
    program New;
    var
      MyVar : integer; //global var


    Procedure SetVar(X: integer);
    begin
      MyVar := X;
    end;

    Procedure WriteVar;
    begin
      WriteLn(IntToStr(MyVar));
    end;

    begin
    SetVar(1);
    WriteVar;
    end.
    Infractions, reputation, reflection, the dark side of scripting, they are.

  5. #5
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay, thanks.
    Active only during the Summer...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Uninitialized variables
    By NosePicker in forum OSR Help
    Replies: 2
    Last Post: 03-20-2008, 07:34 PM
  2. Variables..
    By doritoz in forum OSR Help
    Replies: 19
    Last Post: 09-03-2007, 03:10 AM
  3. how to use variables in typebyte
    By zenma in forum OSR Help
    Replies: 8
    Last Post: 08-15-2007, 06:47 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
  •