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

Temporary variables

Previous pageReturn to chapter overviewNext page

Some methods, but certainly not all, may require the definition of some temporary variable slots in which working results can be held during execution of the method. If these are needed then they are defined immediately after the method header and are enclosed between vertical bar (|) characters. This method defines one temporary variable called aPoint. Temporaries only exist while the method is executing and any objects that are installed in temporary slots are released when the method completes.

Tip: it is convention that all pseudo-and temporary variable names should begin with a lower case letter.