Results 1 to 5 of 5

Thread: Variable

  1. #1
    Join Date
    Apr 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Variable

    Quick question, does the data in the variables within a procedure get stored until the next time the procedure executes or erased? Am I correct that functions keep the data in the variables after the function has finished?
    thanks -l8ern

  2. #2
    Join Date
    Feb 2006
    Posts
    582
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It should, I believe.
    The only thing is if you have a variable inside of a method.. It won't be possible to be accessed by another method outside of it.
    Free File Hosting
    No download timers!

    Rifkwtf.com

  3. #3
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    485
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It depends on global variables and local variables

    Global = everything
    Local = only one procedure

  4. #4
    Join Date
    Feb 2006
    Location
    California-Foster City
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    As i recall, a function is always false until proved otherwise. I do this. In each procedure i reset it at the beginning to 0 or antother nother. by doing var:=0

    In a function, less you are using your own thingy to return. it is auto false or use else
    The Welcoming Party
    Don't be a Fakawi! Get 25 hours of sleep a day!

  5. #5
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea, and variables start at 0. If you want to reset them back to 0, do VarName:= 0

    Global :
    Code:
    program New;
    {.include SRL/SRL.Scar} 
    
    var///These are Global Variables
      i, o, shit, yea : Integer; 
    
    const
    //----------------------
    
    //----------------------
    Local

    Code:
    procedure Showya; 
    var
      y, ui, to : Integer;//Local Variables! Their stored integer can't be used in other                                          
    begin                   //procedures/functions in the same script.
      Writeln('Ok, w/e'); 
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help with storing variable
    By Drew_Dawg in forum OSR Help
    Replies: 1
    Last Post: 02-02-2008, 11:54 AM
  2. UseSandwichSolver variable...
    By orion pax in forum OSR Help
    Replies: 2
    Last Post: 10-22-2007, 08:57 PM
  3. Is there any variable like...?
    By dritar in forum OSR Help
    Replies: 2
    Last Post: 10-05-2007, 06:07 PM
  4. Increasing a variable
    By Its Miller Time in forum OSR Help
    Replies: 12
    Last Post: 06-06-2007, 06:43 PM

Posting Permissions

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