← Back to Library
Lesson PlanFreeFR

(Francais) F3: Variables - Single Variables

Level F, Lesson 3: Students use variables in a program. They will use Blockly preset programs and Challenge Cards to practice their new skills. Objectives Students will: Define a variable. Understand

(Francais) F3: Variables - Single Variables

Educational Standards

CSTA

ISTE

NGSS

Common Core

Before the Lesson

Prior Experience

It is recommended that students complete:

  • Level A-E Lessons: All
  • Level F: Lessons 1-2
  • [Optional] Level A-E Challenge Cards: All
  • [Optional] Level F Challenge Cards: F 1.1-1.3

You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://store.makewonder.com/#/education

Preparation

  • Fully charge the tablets and robots.
  • Install the Wonder Workshop Blockly app on each tablet.

Intstruction

Introduction

  1. Say, “A variable is like a bag: It keeps information stored inside of it. However, there are many ways variables can change. You can add, subtract, multiply, or divide them. You can even use them to help programs make decisions. For example, you can tell the program that if the variable is greater than a certain number, then something will happen.”
  2. Brainstorm with students to come up with real-life examples of variables. For example:
    • Let’s say my wallet has a variable: the amount of money that’s inside it! First, my wallet has 20 dollars inside it, so the variable is 20 dollars. Then I buy a bag of lollipops and take out 5 dollars. Now the value of my variable is 15 dollars!
  3. Say, “For this activity we are going to use variables inside conditionals.”

Quick Check

  • What are conditionals? (Possible response: “Conditionals are statements that help computers make decisions.”)
  • What are variables? (Possible response: “Variables hold numbers that can be changed.”)

Guided Practice

Activity: Dizzy Dash

  1. Project your tablet screen, open the Blockly app, and go to the menu at the top left of the screen.
  2. Go to the Create New Project menu and select the Dizzy Dash preset program. Then tap “create.”Dizzy Dash
  3. Ask the students to look at the program and predict what they think will happen when it is run.
    • Run the program to see if the students’ predictions were correct.
  4. Ask, “What happens when we start the program?”
    • Sample response: “The variable is set to 0.”
  5. Ask, “What happens when Dash’s Top Button is pressed?”
    • Sample response: “The variable increases by 1 and Dash turns in a circle.”)
  6. Ask, “What happens after you press Dash’s Top Button more than 3 times?”
    • Sample response: “Dash says ‘Help,’ moves backwards, and the variable resets to 0.”
  7. Ask, “How can you change the code so that the variable increases by 2 each time you press the Top Button?”
    • Sample response: “You can tap the Change Variable block to change how much the variable increases.”

Quick Check

  • How are variables used in coding? (Sample response: “Variables save pieces of information.”)
  • How are variables used in your life? (Sample response: “I use a variable to keep track of my score in a video game or board game.”)

Wrap Up

Student Presentations

  1. Have student groups take turns sharing one of their programs with the class. Encourage them to:
    • Explain their design thinking (e.g., “We changed the (variable amounts) because we wanted the program to skip count using larger numbers”).
    • Share any obstacles and difficulties they overcame during the activity (e.g., “At first, we didn’t know how to increase or decrease the variable, but we tapped on the Change Variable block and found where to change the amount”).
  2. Encourage students to ask each other how they accomplished different objectives and give each other feedback on their programs. Possible questions/feedback includes:
    • “How did you (add and/or change a variable)?”
    • “I like how you (changed the animations).”
    • “What if you (changed the conditional block)?”

Follow-Up Questions/Discussion

  • Could we have written the same program without using variables? (Sample Response: “No, because variables are the only way we can store information in a code.”)
  • How was the conditional block used in this program? (Sample response: “The conditional block said that if the variable was greater than 3, then Dash would say, ‘Help!’ and move backwards.”)
  • What would happen if you programmed the variable to change by 3 instead of 1? How long would it take Dash to say, “Help!”? (Sample response: “If you programmed the variable to increase by 3, then Dash would say, ‘Help!’ after hitting the Top Button only once.”)

Assessment

  • Use our Evaluation Rubric to review students’ work and presentations.
  • [Optional] Share your students’ work with the world using @logicsacademy and #dashanddot!

Review

Variables Review

  1. Briefly review how students used variables in the previous lesson by asking:
    • ““How did we use variables to tell a story?” (Sample response: “We used variables to hold places for certain types of words.”)
    • “How are variables helpful in coding?” (Sample response: Variables store information in our code.”)
  2. Say, “Today, we will use variables to program Dash.”

Blockly In-App Puzzle [Optional]

  1. Have students complete the Troll of Trepidation puzzle. You can find walkthroughs, solutions, and extensions for the puzzle.
  2. Have students update their Blockly Puzzle Checklists.
  3. Note: If previous puzzles are locked, show students how to quickly unlock them using this strategy: https://help.makewonder.com/customer/en/portal/articles/2318965-how-can-i-reset-challenges-unlock-free-play-or-unlock-wonder-cloud-?b_id=14312

Code.Org Connections [Optional]

  1. Review Code.org’s lesson focusing on variables: https://studio.code.org/s/coursef-draft/stage/6/puzzle/3.
  2. Then ask: “How were variables used in these puzzles?”
    • Sample Response: “The variables held a specific measurement so we could create an equal-sided shape.”
  3. Ask, “Using the same program, could we have used the same variable to create a rectangle?”
    • Sample Response: “No, we could not have used a variable to create a rectangle in this program, as a rectangle has sides of two different lengths, and a variable can only hold one piece of information. You would need two different variables.”

Independent Practice

Instructions

Have students work on the following activities in small groups (ideally 2–3 students per robot).

Encourage students to share tablet and robot time. Have them establish and rotate through roles such as:

  • Lead Programmer: Holds the tablet and manipulates the code.
  • Robot Wrangler: Retrieves and resets the robot after every program attempt.
  • Documentarian: Records group results, thoughts, and progress. Illustrates group designs and ideas.

When students work together while coding, they’re able to help each other identify mistakes and develop creative solutions!

Dizzy Dash Extension

  1. Have students use the Wonder Journal: Dash Planning or General Planning worksheet to design ways to add to or alter the Dizzy Dash preset program. They can:
    • Change the animations and movements.
    • Add lights and sounds.
    • Change how much the variable increases or decreases.
    • Add an event handler.
    • Change the cues.
  2. After they finish revising the program, have students:
    • Complete a Wonder Journal: Reflection worksheet.
    • Take a screenshot of their Blockly code.
    • Take a video of Dash while the code is running.

Challenge Cards [Optional]

  1. You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://logicsacademy.com/store/
  2. Have students complete the following Challenge Cards:
    • F 2.1: Road Trip
    • F 2.2: Pump It Up!
    • F 2.3: On the Road!
  3. For each challenge, encourage students to:
    • Use the Wonder Journal: Dash Planning or General Planning worksheet to discuss how they can complete the challenge.
    • Review the Troubleshooting and Problem Solving & Debugging worksheet if they run into any problems with their code.
  4. After they finish each challenge, have students:
    • Complete a Wonder Journal: Reflection worksheet.
    • Take a screenshot of their Blockly code.
    • Take a video of Dash while running their code.
    • Update their Challenge Card Checklists.