A program needs the following:
At least the ``main'' method must be defined in your code. It
will be called by the interpreter first to run your script. Your code
might actually implement sub-methods as well. A method declaration
- start with the tag ``[ |''
- your code
- and end with ``]''
To call a sub-method you just created in your program, pass its name
and the parameters (if there are some) to the object ``self''
(the representation of your program).
- start with the tag ``!'' (required only for sub-method
- give the name of the method (e.g. main)
- possibly have a declaration of local variables: ``|'',
a list of their names, separated by spaces, and ``|''
- next are the objects and their messages as your programming code
- and last is the return statement: ^self (or another value)
| myVariable |
myVariable := 333.87 .
self printValue: myVariable.
" call ourself with message printValue: and pass myVariable as parameter "
" declaration of method printValue: which receives a paramter in the local variable val "
| localVar |
localVar := val description.
" call the message description on val "
Transcript showLine: ('value = ', localVar).
" return our identification (could be any object) back to caller "
email@example.com version of this document: V3.0