s LearnSqueak.com

ABSOLUTE BEGINNER

Your first uppercase: change the case of a word

Make text uppercase or lowercase in five tiny visual Squeak steps.

5 minutes · 5 small steps · Squeak 6.1

STEP 1

Make a word louder

Single quotes surround text. Select this line and choose Print it. The message asUppercase asks the word for capital letters.

Select the whole expression, then Print it
'Squeak' asUppercase
NATIVE SQUEAK CAPTURE
Native Squeak asUppercase checkpoint 1
Native Squeak Workspace showing the code and its actual evaluated result.
You should see

You should see 'SQUEAK'. Try your own short word.

STEP 2

Make it lowercase

Replace the previous example and its answer. This message changes capital letters to lowercase.

Select the whole expression, then Print it
'SMALLTALK' asLowercase
NATIVE SQUEAK CAPTURE
Native Squeak asUppercase checkpoint 2
Native Squeak Workspace showing the code and its actual evaluated result.
You should see

The answer is 'smalltalk'. The word still has nine letters.

STEP 3

Keep spaces and numbers

Spaces and digits do not have letter case. Print this mixed sentence and compare each part.

Select the whole expression, then Print it
'Hello 2026!' asUppercase
NATIVE SQUEAK CAPTURE
Native Squeak asUppercase checkpoint 3
Native Squeak Workspace showing the code and its actual evaluated result.
You should see

The letters changed; the space, digits and punctuation stayed.

STEP 4

Keep the original too

The name word holds the original. converted holds a separate converted result. Print all four lines together.

Select the whole expression, then Print it
| word converted |
word := 'Squeak'.
converted := word asUppercase.
{word. converted}
NATIVE SQUEAK CAPTURE
Native Squeak asUppercase checkpoint 4
Native Squeak Workspace showing the code and its actual evaluated result.
You should see

The original is still 'Squeak'; conversion did not replace the value held by word.

STEP 5

Compare two simple words

Parentheses make each conversion clear. The equals message compares their lowercase results.

Select the whole expression, then Print it
('HELLO' asLowercase) = ('hello' asLowercase)
NATIVE SQUEAK CAPTURE
Native Squeak asUppercase checkpoint 5
Native Squeak Workspace showing the code and its actual evaluated result.
You should see

You should see true. Try hello and help to get false. This is a simple example, not a complete rule for comparing every language.

YOU DID IT

A small step. A real result.

asUppercase and asLowercase return converted text. Keep the original when you want both versions.

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

Download the five examples; copy one at a time

Your first list · More Smalltalk messages