Objective:
Use variables to store changing values.
A variable is a placeholder for a piece of information that can change.
Question:
In the video, what was the variable that was being changed every year?
Read the following story: "When my family moved to our apartment, all of the walls were an ugly pink. We painted the walls gray, even though I wanted them to be green. Eventually, I convinced my dad to let me paint my bedroom green."
What information changes in the story?
What are the different variables in the story? What are the values for the variables?
What other values could there be for the variables?
Mad Libs are short stories that have some details removed. Users then fill in different words to the placeholders (blanks) to make, fun stories.
In this Mad Lib, an example of a variable placeholder is noun. Examples of values that could fill the placeholder noun include basketball, pencil, dog, and tree.
Click on the Image to open a Mad Libs game in Scratch. Every time the program asks for a noun, adjective, verb or adverb, you are giving information that is stored in a variable.
How many variables are used in this program?
Variables
Write a short story like the one you read at the start of class. Include information that changes value throughout the story, but don't choose colors.
What variable is included at the top of most homework and classwork handouts?
If you finish early:
Complete another level in Code Studio:
Abstraction is the process of pulling out specific differences to make one solution work for multiple problems. The Mad Lib above started out as a specific story about one thing, but we used abstraction to turn some of the words into placeholders (or blanks). This allows the story to be about lots of different things.