This wiki is out of date, use the continuation of this wiki instead

Public variable

From FenixWiki

Revision as of 20:08, 25 June 2007 by Sandman (Talk | contribs)
Jump to: navigation, search


Definition

A public variable is a variable that is specific to a process or function in the same way as a private variable. Unlike a private variable, however, a public variable can be accessed from the rest of the program, by use of the ProcessID of that process. It is like a local variable, but just for one ProcessType instead of for all.

Because of the way the compiler works, public variables are only accessible for processes and functions below the declaration (which in fact is pretty normal). To assist in this matter, the statement Declare was created.

Example

Process SpaceShip
Public
    int speed;
    String name;
Begin
    Loop
        frame;
    End
End

This is for example when a ship is needed, of which the speed and name want to be accessible from the rest of the program. This way, one can easily have multiple instances of the same ProcessType, but still have the appropriate variables easily accessible.

Personal tools