Navigation:  Tutorials > Beginners Guide to Smalltalk > Objects and Messages > Variables and Assignments >

Workspace Variables

Previous pageReturn to chapter overviewNext page

Workspace variables are owned by the workspace in which they are created. They are created automatically when an assignment is made to a variable beginning with a lowercase letter that has not already been declared. The variables in the above example are all workspace variables. The variable slots and the objects that they contain remain in existence until the workspace is closed. For example, try now to display:

hypotenuse.

 

This variable, created by the previous sample, is still in existence and continues to contain the result that was calculated. It will remain while the workspace window is still open and will be accessible to any other expressions that are evaluated in the same workspace. It will not, however, be visible from any other workspace that is opened.