To begin the lesson students explore sample apps similar to the ones they'll be able to build by the end of the unit. Then students complete an unplugged activity with plastic baggies and sticky notes to build a mental model of how variables are used to move and store information. The lesson ends with a synthesizing discussion and students adding key vocabulary to their journal.


Students will be able to:


The warm up activity is designed to provide context for the coming unit and motivate the reasons students will want to learn the concepts covered in Unit 4. The subsequent activity provides students a physical mental model they will be able to use when they start programming with variables in the subsequent lessons.



Getting Started

Explore Sample Apps

Group: Place students in pairs.

Do This: Give students 3-5 minutes to explore the sample apps (beginning with Lesson1_App1 in Unit4 of the CSP-Widgets repository). Students can explore one or more depending on time.

Prompt: These are samples of the kinds of apps you'll be able to build by the end of this unit. As you go through them, write down at least two examples where the app seems to be keeping track of a piece of information or using it to make decisions.

Discussion Goal: Have volunteers share what they noticed with the room. Some ideas include:

Preview the Unit



Group: Group students in pairs.

Distribute: Give each pair of students

Teaching Tip

Supplies Substitutions: There's no need to use stickie notes if you have other scraps of colored paper. Also consider cutting stickies in 4 to make them go further. If you don't have dry erase markers handy consider using pieces of masking tape on the baggies.

Alternatives for Accessibility or Distance Learning: When working with students remotely or students who are blind or visually impaired, consider having students type into an online document rather than using sticky notes or baggies. In this case, individual values can be represented on a single line, where strings are denoted by quotes and numbers don't have quotes. To represent variables, have students write the variable name followed by its value on a single line. Students form expressions by combining standalone values, variables, and operators on a single line.

Using an online document in this way will produce lines of text that will look a lot like code. The important part of the lesson is bringing attention to the concept of storing information in one place, using it again later, or replacing the information in that place with new values.

Guided Activity: Today's activity introduces students to the concept of variables. As a visual aid, you can use Code.org's presentation slides for Unit 4, Lesson 1: Variables Explore. These slides include animations. The notes below describe when to move to the next slide or click through an animation -- if you aren't using the slides, you can ignore these prompts.

Teaching Tip

Running the Activity: This activity asks students to follow along as a number of core concepts for programming are introduced. The model is typically that a term or concept is introduced and modeled and then afterwards students are encouraged to try it out on their own. Trying it out typically means they are writing information on a sticky note and sharing it with another group before discussing the results with the whole class.

Slides with animations have an icon in the bottom left corner to let you know you need to click to reveal more of the slide's content.

To help you more easily prepare the activity and keep track of your instructions, detailed instructions have been included as speaker notes in the presentation. Here are some tips to help you throughout the presentation.

Guided Activity

Slide: Variables Explore

Say: Today we are going to explore Variables.

Slide: Value: Numbers, Strings

Say: We're going to be thinking about how computers work with information. We're going to call one "piece" of information a "value". Right now there are two different types of values: numbers and strings. There are a few ways to tell them apart. Numbers work the way you normally think of numbers. They are made of the digits 0 through 9. We are going to put numbers on yellow sticky notes. When we write numbers you don't need quotes. Strings are made of any characters you can see on the keyboard which means all these examples count as strings. Strings go inside double quotes. You can see how it would be important to tell the number 123 apart from the string "123".

Do This: Make one string and one number and hold it up at your table.

Slide: Operators

Say: Operator is just a fancy name for the plus, minus, multiply, and divide symbols. An expression is a combination of two sticky notes and an operator. When I ask you "what's 2 plus 3" you say "5"! You just "evaluated" the expression 2+3, or figure out what the value is. Since 5 is a number, we put it on a yellow sticky. When evaluating an expression, we follow order of operations - just like in math class.

Do This: Evaluate the expression 5-1 and make a sticky note. Make sure you pick the correct color and decide if you need quotes or not!

Slide: Expression Table

Say: This table shows the different ways we can create expressions. We can use all four operators with numbers the normal way. When you want to use strings, you can only use the + operator and it connects the two words together. If you're connecting a number and a string, the number first gets converted to a string.

Do This: With your partner make a sticky note for each of these 5 expressions and we'll share as a class.

  1. 4 + 5
  2. 10 - 9
  3. "tree" + "house"
  4. "you" + "r"
  5. 3 + "D"

Click for animation: Click through to see the answers on the slide.

Slide: Variables

Say: We're going to call the plastic baggies on your table "variables". Variables can hold at most one value, or sticky note. They have names that use no quotes, include no spaces, and must start with a letter. For now just practice making a variable with your partner.

Do This: Make one variable with any name you like. Share it with another group. Make sure you use a whiteboard marker so we can reuse the baggies later.

Slide: Variables and Expressions

Say: We can evaluate expressions that include variable names. To do that, first make a copy of the sticky note inside the variable. Then evaluate the expression the way you normally would. These two examples show you how.

Click for animation: Click through to see the answers to the examples on the slides.

Slide: Do This: Evaluate these expressions.

Do This: Evaluate these expressions. Make sure to pay attention to whether it evaluates to a string or a number.



  1. 3 * boo
  2. rar + "ep"
  3. rar + boo

Note: Have students share their answers by holding up the sticky notes for each solution.

Click for animation: Click through to see the answers.

Slide: Let's start writing programs...

Say: Now let's write programs. We're going to stop using sticky notes, but will highlight strings and numbers to help you remember the difference.

Slide: var

Say: Here's what a program looks like. The var command tells the computer to create a variable.

Teaching Tip: The slides show code examples that reflect how variables are used in Javascript, which is used for Code.org's App Lab. At this point, the concept of variables is more important than the exact code. There will be opportunities in later slides to discuss the differences between how the two languages handle variables.

Slide: "Assignment operator"

Say: The left arrow is called the "assignment operator". That's just a fancy word for "put this value in the baggy". If we wanted to read line 01 we would say "pow gets 3". We know that variables can only hold one sticky note or value. So if we try to assign a variable that already has a value in it, we just throw the old one away.

Do This: Run this program. What is the result?

  1. var pow
  2. pow <- 3
  3. pow <- 5

Click for animation: Click through to run the program.

Say: In a computer you don't actually put the old number in a trash can, it's totally deleted! The numbers are stored as electrical charges somewhere in your computer's memory. When you assign a new number to a variable it actually erases the old number, and stores the new number in its place.

Slide: Do This...

Do This: Run this program. Compare your results with another group.

  1. var pizza
  2. pizza <- 3
  3. var tacos
  4. pizza <- "yum"
  5. tacos <- "the best"

Note: Walk around the room making sure students are following the rules correctly. No baggies should have more than one sticky note in them.

Click for animation: Click through to see the answers.

Teaching Tip: This is a good opportunity to highlight the difference between variables in Javascript and Quorum. In Javascript, a single variable can hold different types of values over a program -- for example, the "pizza" in this program stores a number, then replaces it with a string. In Quorum, this isn't allowed, because variables must store a specific type. Rather than declaring "var pizza", we might've declared "number pizza" or "text pizza, but it couldn't store both.

If you want to highlight this, you can use this optional prompt:

Prompt: In our program, we can store either a string or a number in the same variable. What if we said each variable could only hold one type of value instead? What are some of the advantages or disadvantages of that approach?

Slide: Assign a Variable with Expression

Say: Now let's combine what we've learned. You can use assignment with expressions. In order for this to work you need to evaluate first, then assign. This makes sense because we know we can only put one sticky note in the variable baggy.

Slide: Do This...

Do This: Run the program. Compare your results with another group.

  1. var zow
  2. var fly
  3. fly <- "to"day
  4. zow <- 4 - 1
  5. fly <- 3 * 3
  6. zow <- 4 + "now

Note: Walk around the room making sure students are evaluating before they assign. Reinforce the language "gets" for the assignment operator. For example, line 02 would read "fly gets two plus day".

Click for animation: Click through to see the answers.

Slide: We're not going to...

Say: We're not going to highlight our strings and numbers anymore. We can just use double quotes around the strings to tell the difference. (NOTE: If you aren't using the slides or otherwise highlighting the values, you can skip this.)

Slide: Assign a Variable: Expressions with Variables

Say: Let's run this program. Evaluate the expression on the right first to get one value. Note that variables aren't "connected." Changing kit doesn't change boo.

Do This: Run through this program together as a class.

  1. var kit
  2. kit <- 1
  3. var boo
  4. boo <- kit + 1
  5. kit <- 5

Note: Reinforce:

Click for animation: Click through to see the answers.

Slide: Do This:

Do This: Run this program. Compare your results with another group.

  1. var fuzz
  2. var clip
  3. fuzz <- 5
  4. clip <- fuzz + 2
  5. fuzz <- clip + 1
  6. clip <- "gr"fuzz
  7. fuzz <- fuzz + 1
  8. fuzz <- fuzz + 1
  9. fuzz <- fuzz + 1

Note: Have students hold up their two baggies when they're done. Make sure students are evaluating and then assigning. Call out that last three lines which can be a little nutty to think about. You're using a variable's value as part of the assignment. This lets it "count up by one".

Click for animation: Click through to see the answers.

Slide: Key Takeaways

Do This: Review the key takeaways with students.

Slide: In some languages...

Say: In some programming languages (including Quorum and Javascript) the assignment operator is not written with an arrow but is written as an equal sign.

Slide: So the command...

Say: That means that in those languages, fuzz <- fuzz + 1 would be written as fuzz = fuzz + 1. We'll see more of this in the next lesson!

Note: In math "=" means "are equal forever". In programming "=" means "put this value in this variable".

Wrap Up

Journal: Have students add the following words to their journals: Expression, Variable, Assignment Operator.


Assessment: Check for Understanding

Question: What will the value of score be at the end of the program?

var score
score <- 3
score <- score + 1
score <- "The score is: " + score

Standards Alignment