"Sputnik" help  
Sputnik Help
Language Reference - Variables - Scopes


A variable's scope is controlled by when and how you declare the variable. In most cases your variables will be Global unless you specifically set them to local using the My keyword. Global scope and can be read or changed from anywhere in the script.

If you declare a variable inside a function and you made it local scope it can only be used within that same function. Variables created inside functions are automatically destroyed when the function ends.

The same is true for classes.

So inside a function you only have the function/class(and class function) itself as a local scope to use and outside a function your local scope is the actual script itself.

However if you "really" need a new local scope any any point you can use the Scope statement (go see its examples).

In Sputnik variable scopes are defined in the following order first the main script itself has it's own stack (variable scope) then each function you call has a newly created stack just for it and finally each individual class has its own stack (Which stores it's variables and so on).

This means there is no push/pop going on in Sputnik like most other languages so when { } is entered by itself it does *not* become a scope.

This is done to make Sputnik faster and more reliable.

Sputnik can handle scopes however it just does them in a different way instead of { } the Scope statement is used to access scopes this lets you decide when and where you use a scope instead of having it forced and automatic slowing the language down.

Go see the Scope statement.

Cheryl (uberfox@hotmail.com)