Variables

Variable value

This lesson introduces the use of variables to store data or the results of mathematical operations. Students will practice giving variables unique and meaningful names. We will also introduce the basic mathematical operations for adding, subtracting, multiplying, and dividing variables.

Lesson Objectives

Students will…

  • Understand what variables are and why and when to use them in a program.
  • Learn how to create a variable, set the variable to an initial value, and change the value of the variable within a micro:bit program.
  • Learn how to create meaningful and understandable variable names.
  • Understand that a variable holds one value at a time.
  • Understand that when you update or change the value held by a variable, the new value replaces the previous value.
  • Learn how to use the basic mathematical blocks for adding, subtracting, multiplying, and dividing variables.
  • Apply the above knowledge and skills to create a unique program that uses variables as an integral part of the program.

Lesson plan

  1. Overview: Variables in Daily Life
  2. Unplugged: Rock Paper Scissors
  3. Activity: Make a Game Scorekeeper
  4. Project: Everything Counts

Targeted CSTA standards