Educator Guide - Unit 4 Conditionals
Educator Guide - Unit 4 Conditionals
Science
Unit 4:
Conditionals
Educator guide
makecode.microbit.org
Table of Contents
Overview....................................................................................................................................................... 3
Unit summary............................................................................................................................................. 3
Lessons....................................................................................................................................................... 3
Learning goals............................................................................................................................................ 3
CSTA K-12 computer science standards..................................................................................................... 3
Required educator preparation...................................................................................................................... 4
Preparing to lead the unit........................................................................................................................... 4
Required skills............................................................................................................................................ 4
Recommended resources........................................................................................................................... 4
Lesson A: Conditionals in daily life................................................................................................................. 5
Lesson plan................................................................................................................................................ 5
Outline........................................................................................................................................................ 5
Before the lesson........................................................................................................................................ 5
Lesson details............................................................................................................................................. 6
Section 1: Introduction to conditionals.................................................................................................... 6
Section 2: Understanding conditionals.................................................................................................... 7
Section 3: Wrap-up.................................................................................................................................. 9
After the lesson........................................................................................................................................ 10
Lesson A assessments.............................................................................................................................. 10
Lesson B: Rock, paper, scissors................................................................................................................... 11
Lesson plan.............................................................................................................................................. 11
Outline...................................................................................................................................................... 11
Before the lesson...................................................................................................................................... 11
Lesson details........................................................................................................................................... 12
Section 1: Introduction.......................................................................................................................... 12
Section 2: Code with conditionals.......................................................................................................... 12
Section 3: Wrap-up................................................................................................................................ 15
After the lesson........................................................................................................................................ 15
Lesson B assessments.............................................................................................................................. 16
Lesson C: Code a board game..................................................................................................................... 17
Lesson plan.............................................................................................................................................. 17
Outline...................................................................................................................................................... 17
Before the lesson...................................................................................................................................... 17
Lesson details........................................................................................................................................ 18
Section 1: Introduction.......................................................................................................................... 18
Section 2: Make a micro:bit board game............................................................................................... 18
Section 3: Wrap-up................................................................................................................................ 26
After the lesson........................................................................................................................................ 27
Lesson C assessments.............................................................................................................................. 27
Overview
Unit summary
Introduction to Computer Science Unit 4: Conditionals | 2
This unit introduces the Logic blocks, such as ‘If…then’
and ‘If…then…else’. Students practice skills of creativity,
problem solving, and collaboration. Students will learn
what conditional statements are, and why and when to
use them in a program. In the unplugged activity,
students experience conditionals through acting them
out in real life. Then they code a game of “Rock, paper, Once-a-week timeframe
scissors” with the micro:bit via the programmable
buttons and the LED screen. In the final project, students If your class meets only once a week,
design, build, and code their own unique micro:bit-based this unit may take four weeks to
board game using conditionals. complete.
Each of the following lessons is intended to be broken Week 2: Lesson B: Rock, paper,
into as many class sessions as needed to complete the scissors
activities.
Weeks 3–5: Lesson C: Code a board
Lesson A: Conditionals in daily life (approx. 45-60 min) game
Lesson B: Rock, paper, scissors (approx. 60-75 min)
Lesson C: Code a board game (approx. 60-120 min)
Learning goals
During this unit, students will:
Understand what conditional statements are and why and when to use them in a program.
Learn how to use the Logic blocks ‘If…then’ and ‘If…then…else’.
Practice using the Logic blocks so different conditions yield specified outcomes.
Demonstrate understanding and apply skill by collaborating with classmates to create a game that
uses a micro:bit and a program that correctly and effectively uses conditionals.
1B-AP-10 Create programs that include sequences, events, loops, and conditionals.
2-AP-10 Use flowcharts and/or pseudocode to address complex problems as algorithms.
2-AP-12 Design and iteratively develop programs that combine control structures, including nested loops
and compound conditionals.
Watch the correlating unit quick-start video for a brief, high level introduction to the activities and
project.
Review all materials thoroughly and become confident with content.
Practice all activities and check your programming against the solution link provided with the
coding activities.
Required skills
To lead the activities in this unit successfully, you need to be able to:
Recommended resources
If you would like additional support to master the concepts and skills covered in this unit, review the
following resources.
Outline
Section 1: Introduction to conditionals
Section 3: Wrap-up
Review: Review learning goals, what the students accomplished, and preview the next lesson
Exit ticket: Distribute and collect the exit ticket to assess learning
Educator notes
1. Write the “Do now” on the board for students to think about as they arrive:
Think of examples to fill in the blanks of this sentence: If __________, then __________.
Answer: Responses will vary
2. Introduce the lesson, learning goals, and discuss their responses to the “Do now.”
3. Introduce the concept of conditionals.
Computer programs are instructions telling the computer how to process input and deliver output. An
important part of programming is telling the computer WHEN to perform a certain task. For this, we use
something called conditionals. Conditionals get their name because a certain condition or rule must be met
in order for an action to be carried out.
Students are all already familiar with the concept of conditionals in their daily lives!
“If you clean your room, you can go out with your friends.”
“If your homework is done, you can play video games.”
“If you do your chores all week, you get your allowance, else you are grounded.”
These are all conditionals! Conditionals follow the format of IF this, THEN that.
Have the students share a few conditionals from their own lives with the class or within small groups.
Educator notes
An unplugged activity is an activity that takes place away from the computer—in other words,
“unplugged” from technology. This introduces new concepts in a fun way that gets students up and
moving, often reacting and interacting with other students face to face while playing a game or
completing a challenge. Unplugged activities allow students to practice concepts away from devices
so that when they move to coding activities, they have already walked through and thought about
the concepts on their own.
Optional materials
Pencils and lined paper (if doing this activity seated). Students can advance across the paper instead
of the room with an one-inch line equal to one step.
Objective
Overview
Note: As the educator you will need to keep an eye out for
any “errors” that occur during the running of the program.
Process
1. Have the students line up at one side of the room.
2. Explain the rules:
For if...then...else conditionals, listen carefully to the whole condition as the “else” may apply to you.
3. After the students get the idea of the game, allow them to make up and call out conditionals (that
meet educator approval). They will need to be observant, as a conditional that moves them forward will
also move their competition forward!
The conditionals you use will depend on your individual class. Here are examples:
Discussion
How did it go?
Were there any “runtime errors?”
Did anyone miss a conditional being met or fail to correctly carry out the THEN or ELSE action?
Were there some conditions that could be evaluated as something other than true or false (maybe,
sometimes)?
Extensions/variations
Add AND, OR, AND/OR statements to the conditionals. Example: If you have brown hair AND brown
eyes, then…
Create nested IF’s. Example: If you are wearing sneakers, then… if you are also wearing white socks,
take three steps forward.
Let students create their own conditionals for future program runs with the class. (A very popular
activity, though all conditionals should be run by the educator first for approval.)
Relate this activity to a system and have the students create the conditionals that would end in a
product of some kind or the completion of some task, like writing a sentence or setting a table or
constructing a simple structure.
Section 3: Wrap-up
Educator notes
1. Review learning goals with students, what they accomplished, and preview the next lesson.
2. Distribute and collect the exit ticket.
Assessment
Review the exit ticket responses.
Reflection
Consider if there were any concepts of the lesson or exit ticket students struggled with that you
might want to reinforce or re-teach at the beginning of the next lesson.
Consider what aspects of the lesson students found engaging and how you might emphasize those
in the next lesson.
Follow up on any questions that arose during the lesson that require additional research on your
part.
Lesson A assessments
“Do now”
Think of examples to fill in the blanks of this sentence: If __________, then __________.
Answer: Responses will vary.
Exit ticket
Format: Printed half-page handout for students to complete and turn in as they leave class. (Printer-
friendly versions are found in the assessment guide.)
Question Answers
Outline
Section 1: Introduction
Section 3: Wrap-up
Review: Review learning goals, what the students accomplished, and preview the next lesson
Micro:bit
Micro-USB cable
Section 1: Introduction
Educator notes
1. Review Write the “Do now” on the board for students to think about as they arrive:
What’s the purpose of conditionals in coding?
Answer: It tells a program WHEN to perform a certain task
(An alternative correct answer could be: It tests to see if a certain condition, criteria, or rule is
met before performing an action)
2. Introduce the lesson and learning goals.
3. Discuss their responses to the “Do now.”
Educator notes
1. Use your established equipment safety procedures for distributing and using the hardware and
ensure students are properly set up to begin coding in MakeCode and micro:bit.
2. Follow the instructions to lead the birdhouse activity. Do the activity on your device connected to
the projector or presentation screen and have students follow along as you complete each step. If
you don’t have a projector or screen, move throughout the room between steps to check for
understanding and help facilitate the activity.
3. After the activity, distribute the quiz (see the assessment guide for a printable format).
4. If you have time during class, consider reviewing the quiz answers as a group activity.
Each unit contains a micro:bit activity, which we informally refer to as a “birdhouse” activity, after
the innumerable wooden birdhouses so many of us made in Woodshop as a way to master basic
skills. The activity is an example that walks students step by step through building a project that
demonstrates that lesson’s topic. By the time students finish the activity, they will have written code
that they can use in a different project of their own design.
Objective
Have students recall the classic “Rock, paper, scissors” game that they played in Unit 3: Variables.
Example: If Player A gets rock, and Player B gets scissors, then Player A wins.
Have students write the pseudocode for how to play the game on the micro:bit.
Example pseudocode:
Point out that because there are only three possibilities, we don’t need to do a separate check to see if it’s
a random number; we just need to use an else.
Working from the pseudocode specifications, have students work in pairs to try to code a Rock, paper,
scissors game on their own.
If students get stuck, there is a Rock, paper, scissors tutorial on the MakeCode home page under the
category of games that leads students step-by-step through the process of coding a working Rock, paper,
scissors game for their micro:bit.
Educator notes
1. Review the learning goals with students, what they accomplished, and preview the next lesson.
2. Use your established equipment safety procedures for collecting and storing the hardware.
Assessment
Review and grade the quiz (unless you reviewed with your students in class).
Reflection
Consider if there were any concepts of the lesson or quiz students struggled with that you might
want to reinforce or re-teach at the beginning of the next lesson.
Consider what aspects of the lesson students found engaging and how you might emphasize those
in the next lesson.
Follow up on any questions that arose during the lesson that require additional research on your
part.
“Do now”
Quiz
Format: Printed full-page handout for students to complete during class. (Please see the assessment guide
for printer-friendly versions to distribute to students.)
Questions Answers
1. What’s an example of an “If…then” statement? Responses will vary and need to follow
the format: If _____, (then) _____
2. What’s an example of an “If…then…else” statement? Responses will vary and need to follow
the format: If _____, (then) _____, else
_____
4. Write an example of pseudocode for your micro:bit Responses will vary and need to follow
using conditionals. the format: On shake: choose random
number from 1-3, If random number =
1, then display paper icon, Else if
random number = 2, then display rock
icon, Else display scissors icon.
5. True or false: A conditional statement must have all False. Only if and then need to be
the following: If, then, else included in a conditional statement, else
is optional
Outline
Section 1: Introduction
Section 3: Wrap-up
Exit ticket: Students complete a Reflection Diary entry for their project
Review: Review the learning goals, what students accomplished, and preview next unit
Section 1: Introduction
Educator notes
1. Write the “Do now” on the board for students to think about as they arrive:
What is an example of each type of conditional statement: “If…then” and “If…then…else” ?
Answer: Responses will vary and need to follow the following formats:
a. If ______, then ______
b. If ______, then ______, else _______
2. Introduce the lesson, learning goals, and discuss responses to the “Do Now.”
3. Review any themes that students are struggling with from the quiz results unless you covered
this at the end of the last lesson.
Educator notes
1. Use your established equipment safety procedures for distributing and using the hardware and
ensure students are properly set up to begin coding in MakeCode and micro:bit.
2. Follow the instructions to explain the expectations for their project, provide ideas, examples, and
the scoring rubric, which are also in the student workbook.
3. Encourage students who finish early or need an extra challenge to try one or more of the Mod
ideas.
4. After the activity, consider having students share their projects in pairs, small groups, or with the
rest of the class as time allows.
5. Be sure to allow enough time for students to complete their Reflection Diary entry in the next
section.
Objective of projects
Open-ended projects are opportunities to apply the concepts and skills students have developed in
an original and creative way. Students will work on their projects in a “collaboratively independent”
way, which means each student is responsible for turning in his or her own project but is encouraged
to work together and help each other while doing so. Some form of reflection is an important part of
documenting the learning that has taken place.
Once students have finished the first version of their games, schedule time for students to play each
other’s games. Ideally, give them some time to give and gather feedback, then revise their games
accordingly.
Introduction
Many board games use an electronic toy to signal moves or provide clues. There are some funny examples
online if you search for “electronic board game”. Below are some examples:
Electronic Dream Phone Board Game Commercial – 1992 at youtu.be/pqYsQgDqlmg (0:30): This
board game is really a logic puzzle. There are printed clues that illustrate relationships and the
phone provides clues that help you to narrow down possibilities by a process of elimination.
Stop Thief Electronic Board Game commercial –1979 at youtu.be/q3wpPRdDy4E (0:30): This board
game uses a device to give audio clues that help you to figure out what to do on the game board.
It’s a good example of how you might use sound as a clue.
Assignment
Students should work in pairs to create an original board game project in which micro:bit is a central
feature, and the rules of their board game should use Conditionals.
Ideally, students should be writing their own versions of micro:bit programs to do something original.
Project examples
1. Battle pieces
Rules:
Up to four players.
micro:bit holder
Game pieces
Give students a chance to play each other’s games. The following process works well:
Have each pair of students set up their own project at their table.
Leave a clipboard or a laptop on the table for taking notes.
Rotate the students through each project, moving clockwise around the room:
Play the game (5 min)
Fill out a survey form (5 min)
Did you have fun playing the game? Why or why not?
How easy was it to figure out what to do?
What is something about this project that works really well?
What is something that would make this project even better?
Any other comments or suggestions?
Many online survey tools will allow you to sort the comments by project and share them with project
creators so they can make improvements based on that feedback.
Project expectations
Follow the design thinking approach and make sure your project meets these specifications:
Assessment
1 2 3 4
elements
Rules Most of the game More than one A game rule is All game rules are
rules are missing game rule is missing or not clear and complete.
or it is not clear missing or not complete or not
what the rules complete or not clear.
are. clear.
Game board Game board Game board Game board Gameboard is:
meets only one meets only two of meets only three
of the conditions the conditions of the conditions Complete
listed for a score listed for a score listed for a score Neat
of 4. of 4. of 4.
Fits with the theme
of the game
micro:bit is a
central part of the
game
Educator notes
1. Explain the expectations and scoring rubric for the Reflection Diary entry for their project, also in
the student workbook.
2. Review the learning goals with students, what they accomplished, and preview the next unit.
3. Use your established equipment safety procedures for collecting and storing the hardware.
Reflection Diary
Expectations
Explain how you decided, as a pair, on your particular board game idea.
What was something that surprised you about the process of creating this game?
Describe a difficult point in the process of designing this game and explain how you resolved it.
What feedback did your beta testers give you? How did that help you improve your game? What
were the conditionals that you used as part of your game rules?
Assessment
1 2 3 4
elements
Diary entry Diary entry is Diary entry is Diary entry is Diary entry
missing three or missing two of the missing one of the addresses all
more of the required elements. required elements. elements,
required elements. including:
Brainstorming
ideas
Construction
Programming
Beta testing
Assessment
Review and grade the projects and diary entries. (A full page, printer-friendly version of the project
scoring rubric is available in the assessment guide.)
Reflection
Consider if there were any concepts of the lesson, project or diary entries students struggled with
that you might want to reinforce or reteach before or at the beginning of the next unit.
Consider what aspects of the lesson students found engaging and how you might emphasize those
in the next unit.
Follow up on any questions that arose during the lesson that require additional research on your
part.
Lesson C assessments
“Do now”
Write a diary entry of about 150–300 words addressing the following points:
Explain how you decided, as a pair, on your particular board game idea.
What was something that surprised you about the process of creating this game?
Describe a difficult point in the process of designing this game and explain how you resolved it.
What feedback did your beta testers give you? How did that help you improve your game? What
were the Conditionals that you used as part of your game rules?