Prev: Starting BLOX. Up: Using BLOX. Next: Browsing classes.

Evaluating expressions

BLOX starts with the worksheet, a window where you can tell it to execute Smalltalk expressions. In addition to being an excellent place to become familiar with Smalltalk expressions, this is convenient later when we create classes and want to test them.

As an example of executing an expression, type the following, which says to send a not message to the already-defined true object.

true not
After typing this, select ``Print it'' from the Edit menu, or type the shortcut Alt-P. Note that when you do this, BLOX will display the value of the expression (in this case, false), and it will helpfully highlight the value so the next keystroke you press deletes the printed value.

If you want to create a variable, you can do so simply by using an assignment.

scores := Array new: 5
After typing this, select ``Do it'' from the Edit menu, or type the shortcut Alt-D.

Now you can execute various expressions using this variable.

scores at: 4 put: 90           Select ``Do it'' or Alt-D
scores                         Select ``Print it'' or Alt-P

Prev: Starting BLOX. Up: Using BLOX. Next: Browsing classes.