Hello, and welcome to day 5 of Google CS First Friends.
Today you will imagine a text message conversation that you and your friend might have in the future.
You will also learn about an important computer science concept: procedures.
A procedure is a set of computer instructions that can be used by several different parts of a program.
To make a procedure in Scratch, you can create an entirely new block.
Once you’ve created a new block, define what it does by building a block stack and snapping it below the new block.
You can use the new block whenever you want to run this block stack.
For example, you could create a new block called "meow."
Then, you could attach a block stack that tells the sprite to play a meow sound 3 times, then move forward 5 steps.
This would make this whole list of actions happen every time you use the "meow" block in the code.
You don’t have to build the entire block stack every time.
Creating a procedure, or "new block," in Scratch lets you do more with less code!
Computer science uses procedures in lots of ways.
Any computer program that repeats a single set of instructions in more than one place probably uses procedures.
For example, check out this phone app that allows the user to virtually try on different styles of makeup.
Watch how Taylor swipes the screen to a new style of makeup.
The program identifies where her eyelids and lips are on the image.
Next, the program overlays the new makeup colors.
With each swipe, the color of the makeup changes, but the functionality of "Find Eyelids" and "Find Lips" stays the same.
To keep from repeating the same instructions over and over to make this work, a computer scientist could create an "Apply Lipstick" procedure.
Each time the user swipes, the “apply lipstick” procedure is called, and a different lipstick color is used.
The procedure lets the computer scientist save time by reusing the same stack of code multiple times.
In today's activity, you will imagine a text conversation you might have with your friend in the future.
Imagine what your lives will be like.
Will you and your friend be at the same college?
Will you share an apartment or work at the same company?
Will you have houses on the same street?
Imagine what you might text to your friend in that future world.
You can choose one of these ideas to start your story: Imagine telling your friend a piece of good news.
Or, asking your friend for some advice.
Or congratulating your friend on some success they will have in the future.
Let’s get started!
Taylor will take you through the steps to build your project, and I’ll see you in the last video.
See you! Bye, Jason!
Now, it’s your turn!
Click on the starter project on this page.
Click Remix, and name the project.
Choose a story starter or come up with your own story idea.
Return to this page, and click the green arrow to move on.
- Click on the starter project on this page.
- Click Remix, and name the project.
- Choose a story starter or come up with your own story idea.
- Return to this page, and click the green arrow.
- "Roommates (3218131407).jpg" by Tulane Public Relations (https://commons.wikimedia.org/wiki/File:Roommates_(3218131407).jpg) -- Licensed by CC BY 2.0 (https://creativecommons.org/licenses/by/2.0/)
- "Happy Go Lucky" by Scott Holmes (http://freemusicarchive.org/music/Scott_Holmes/Music_for_TV__Film/Happy_Go_Lucky) -- Licensed by CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)
- "Albany Houses.jpg" by UpstateNYer (https://commons.wikimedia.org/wiki/File:Albany_Houses.jpg) -- Licensed by CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/deed.en)
- "Hyperlocal Event/ Digwyddiad hyperleol" by National Assembly for Wale's (https://www.flickr.com/photos/nationalassemblyforwales/16379460273/) -- Licensed by CC BY 2.0 (https://creativecommons.org/licenses/by/2.0/)
- "9TH Drew Storen and Wilson Ramos.jpg" by MissChatter (https://commons.wikimedia.org/wiki/File:9TH_Drew_Storen_and_Wilson_Ramos.jpg) -- Licensed by CC BY 2.0 (https://creativecommons.org/licenses/by/2.0/)