- Grades 1 - 2
- Beginner level
- 8 lessons
- Tynker Blocks
- Web iPad
- 8 lessons
- 48 activities
- Enhanced Creativity Tools
- Automatic Assessment
- Tutorials and Reviews
- Coding Puzzles
- DIY Projects
- Answer Keys
No previous coding experience required.
Course: Space Cadet
Lesson 7: Shifty Aliens
Number of Levels: 5
Time: 30+ mins
IntroductionIn this lesson, students will use "if" and "if-else" statements to create programs that react to changing or uncertain conditions, such as aliens appearing in varying locations. By using "if" statements, students can create a program that “makes decisions” on its own. An "if" statement is a conditional statement that gives instructions only if the condition is true. For example, if you said the if statement “If you’re happy, clap your hands”, your students would only clap their hands if they are happy. Otherwise, the command “clap your hands” would be ignored. "If-else" statements are similar to "if" statements, but the have the extra “else” component which contains the instructions that are to be followed if the condition is not true.
New Code Blocks
: If the condition is true, then run the code inside this block. : If the condition is true, then run the code inside the "if" case. Otherwise, run the code inside the "else" case.
- Use conditional statements
- Apply coding concepts and logic to solve puzzles
- iPads (with installed Tynker app), computers, or laptops
Warm-Up (5 minutes)Explain to students that an "if" statement is a conditional statement that gives instructions only if the condition is true. Next ask them to write 3-5 real-world examples of "if" statements. Here's an example: If it's raining outside, then I will wear my rain boots. If students are struggling, here are some prompts to help them get started:
- If it's snowing outside, then…
- If it's the weekend, then…
- If I complete all my chores, then...
Activities (30 minutes)Facilitate as students complete all Shifty Aliens modules:
- Inform students that this lesson has 5 levels that they need to complete.
- In level 1, students will need to use the "repeat until" and "if" blocks to move the character to the crystal. Give a hint: Ask students to place the "if" block inside the "repeat until" code block.
- Level 2 requires students to avoid the aliens and move their character to the crystal. Make sure students are using the conditional "if" blocks to check if there is either an alien or a set of stacked aliens in front of their character before walking forward.
- To solve levels 3-5, students will need to use a "repeat until" block to move their character to the crystal. Make sure students use the conditional "if" blocks to check if there is a set of stacked aliens in front of the character or if the character can just walk forward.
- When students get to level 5, point out that the aliens can change from a single alien to a set of stacked aliens at any time.
Extended Activities (10 minutes)Discussion
Ask your students…
- How did you apply "if-else" statements in today's coding activities?
- Who can give a real-world example of an "if-else" statement?
- What's the difference between "if" statements and "if-else" statements?
- CCSS-Math: K.CC.B.5, 2.OA.B.2, MP.1
- CCSS-ELA: RF.K.4, RF.1.4, RF.2.4, RF.1.4.A, RF.2.4.A, 1.RI.10, 2.RI.10
- CSTA: 1A-AP-09, 1A-AP-11
- CS CA: K-2.AP.13
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b
U.K. StandardsKey Stage 1
- Use logical reasoning to predict the behaviour of simple programs
- Use technology safely and respectfully, keeping personal information private; identify where to go for help and support when they have concerns about content or contact on the internet or other online technologies
- Design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.
- Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs.
- Understand computer networks, including the internet; how they can provide multiple services, such as the World Wide Web, and the opportunities they offer for communication and collaboration.
- Use technology safely, respectfully and responsibly; recognise acceptable/unacceptable behaviour; identify a range of ways to report concerns about content and contact.