For today’s lesson, you will learn a different way to write the code used in the last lesson. What you learn today can help to simplify your code. You will also see code written this way a lot, and learning it will help you understand what you are looking at.
1. Make the changes below to the code that you typed in the previous lesson. After making your changes, select “do it”:
s := SimpleButtonMorph new
label: 'Move right';
target: moveRight;
actionSelector: #value;
openInWorld.
2. You should have noticed that your code ran exactly as it did before. The only difference now is how your code looks.
3. The difference is in the use of a semicolon, which, when used this way, is called a cascade. Cascaded messages allow you to send multiple messages to the same receiver.
4. Save and Quit your Smalltalk image.