SRL Archive - General

Variable


l8ern

2006-04-24 19:07:12

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

Pwnd

2006-04-24 19:21:48

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.

The Prince of Randomness?

2006-04-25 00:33:14

It depends on global variables and local variables

Global = everything
Local = only one procedure

Sdcit

2006-04-25 00:42:20

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

WhiteShadow

2006-04-25 01:49:19

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

Global :

program New;
{.include SRL/SRL.Scar}

var///These are Global Variables
i, o, shit, yea : Integer;

const
//----------------------

//----------------------

Local

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;