s LearnSqueak.com

ABSOLUTE BEGINNER

Your first Point: two numbers together

Make a tiny two-number address, read it, and move it in five small steps.

5 minutes · 5 small steps · Squeak 6.1

STEP 1

Make a pair

Click an empty part of the Squeak desktop. Choose open… then workspace. Type this line, select it, right-click and choose print it (p). Some setups use middle-click for this menu.

The @ joins two numbers into a Point. Think of it as a tiny address: 20 across, 30 down.

Select the whole line → print it (p)
20@30
NATIVE SQUEAK CAPTURE
Native Squeak Workspace showing 20@30 with the selected printed result 20@30.
The real Print it command answers 20@30.
You should see

20@30

STEP 2

Read the first number

Replace all the old text, including the old answer, with this line. Select the whole line and choose print it (p).

x asks for the first number. The parentheses keep the pair together.

Select the whole line → print it (p)
(20@30) x
NATIVE SQUEAK CAPTURE
Native Squeak Workspace showing (20@30) x with the selected printed result 20.
The real Print it command answers 20.
You should see

20

STEP 3

Read the second number

Replace all the old text, including the old answer, with this line. Select the whole line and choose print it (p).

y asks for the second number. On the Squeak screen, larger y positions are farther down.

Select the whole line → print it (p)
(20@30) y
NATIVE SQUEAK CAPTURE
Native Squeak Workspace showing (20@30) y with the selected printed result 30.
The real Print it command answers 30.
You should see

30

STEP 4

Move the pair

Replace all the old text, including the old answer, with this line. Select the whole line and choose print it (p).

Add two Points to add their numbers separately: 20 + 10 and 30 + 5.

Select the whole line → print it (p)
(20@30) + (10@5)
NATIVE SQUEAK CAPTURE
Native Squeak Workspace showing (20@30) + (10@5) with the selected printed result 30@35.
The real Print it command answers 30@35.
You should see

30@35

STEP 5

Check your answer

Replace all the old text, including the old answer, with this line. Select the whole line and choose print it (p).

The = asks whether the two Points are equal. Squeak answers true: both numbers match.

Select the whole line → print it (p)
((20@30) + (10@5)) = (30@35)
NATIVE SQUEAK CAPTURE
Native Squeak Workspace showing ((20@30) + (10@5)) = (30@35) with the selected printed result true.
The real Print it command answers true.
You should see

true

YOU DID IT

Two numbers. One Point.

@ makes a Point. x and y read its two numbers. Adding Points changes both numbers together.

In step 4, replace 20@30 with 40@50. Print it again. Can you predict 50@55 before you run it?

Optional code download: open it as text and copy one example into Workspace.

Five Point examples (.st)

Make your first Morph · Explore shapes and movement