variables these are just objects that store information...

4
Step 1. Step 2. Step 3. Make a variable, which is just an object that stores a value. Name it ‘x’. Make another variable, and name it ‘y’. Choose the ‘when Sprite clicked control. Then make the cat say ‘hello’ and ‘Let’s do some math! Variables – these are just objects that store information. Please follow the steps below to create two variables that add two numbers. Don’t skip steps! Have patience and you’ll get it to work in no time at all!! K.Rusniak_10/19/12

Upload: others

Post on 30-Apr-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Variables these are just objects that store information ...scratched.gse.harvard.edu/sites/default/files/mathexample_101912.p… · program. Type your answer in the box that appears

Step 1.

Step 2.

Step 3.

Make a variable, which is just an object that stores a value.

Name it ‘x’.

Make another variable, and name it ‘y’.

Choose the ‘when Sprite clicked control. Then make the cat say ‘hello’ and ‘Let’s do some math!

Variables – these are just objects that store information. Please follow the steps below to create two variables that add two numbers. Don’t skip steps! Have patience and you’ll get it to work in no time at all!!

K.Rusniak_10/19/12

Page 2: Variables these are just objects that store information ...scratched.gse.harvard.edu/sites/default/files/mathexample_101912.p… · program. Type your answer in the box that appears

Step 4.

Step 5.

Step 6.

Add the commands above to set ‘x’ and ‘y’ to ‘0’.

Replace the ‘0’ in each box with a green ‘pick random’ box.

Use the light blue ‘ask’ command to ask what is ‘x’ + ‘y’? This command lets you answer the question later.

Add an ‘if else’ condition.

K.Rusniak_10/19/12

Page 3: Variables these are just objects that store information ...scratched.gse.harvard.edu/sites/default/files/mathexample_101912.p… · program. Type your answer in the box that appears

Step 7.

Step 8.

Step 9.

Add an ‘=‘ operation.

Add a ‘+’ operation on the left of the ‘=‘ operation.

Add ‘x’ and ‘y’ to the left of ‘=‘.

K.Rusniak_10/19/12

Page 4: Variables these are just objects that store information ...scratched.gse.harvard.edu/sites/default/files/mathexample_101912.p… · program. Type your answer in the box that appears

Step 10.

Step 11.

Add the light blue ‘answer’ object on the right.

Now add some actions. Say ‘Great job!!’ in the first line and ‘Oops. Try again’ in the second.

Congratulations. You’re done. Your program should look like the final example above. Click on the cat to run your program. Type your answer in the box that appears below the cat and press the check mark to check your answer. Click the cat to play again. Now you know how to make the computer add numbers, and you created a game too! I hope you liked this project!

K.Rusniak_10/19/12