Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Scratch 1.4: Beginner's Guide

You're reading from   Scratch 1.4: Beginner's Guide Learn to program while creating interactive stories, games, and multimedia projects using Scratch

Arrow left icon
Product type Paperback
Published in Jul 2009
Publisher Packt
ISBN-13 9781847196767
Length 264 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Time for action – label newAmount


We will once again compare the days and count values as a way to determine if we should perform an action. This time, we want to know when to display the value in the newAmount variable:

  1. Select the double sprite from the list of sprites.

  2. Add a second when space key pressed control block to the scripts area.

  3. Add a wait until block to the when space key pressed block.

  4. We want to wait until count = days before we run our code. Add the = block to the wait until block.

  5. From the Variables palette, add the count block to the left side of the equals block and the days block to the right side of the equals block.

  6. From the Looks palette, add the say block to the wait until block.

  7. We want to report the value in the newAmount variable, so drag the newAmount block into the say block.

  8. Run the script. The final value displays in a speech bubble on the screen.

What just happened?

If we started with one dog bone and doubled it every day for seven days, we would have ended up with...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image