Conditionals-554x368.png

Conditionals

8-10 yrs old

11-13 yrs old

14-18 yrs old

Computer Science

Reading and Writing

Learn more how to use Conditionals in blocks, JavaScript and Python with MakeCode Coding Editor.

1
avatar Submitted By: Minecraft Education

October 12, 2020

Skills

  • Creativity
  • Critical Thinking

Learning Objectives

  • Learn how to use a variety of loops to repeat sections of code.
  • Learn the purpose of conditional loops.
  • Learn how conditional loops work inside code.
  • Utilize the following Common Core Standards - English Language Arts: CCSS.ELA-LITERACY.RI.3.3, CCSS.ELA-LITERACY.RI.3.8
  • Utilize the following CSTA standards: 1A-AP-08, 1A-AP-09, 1A-AP-10, 1A-AP-11, 1A-AP-14, 1B-AP-10
  • Utilize the following ISTE standards: 5D

Guiding Ideas

These learning activities are designed to provide the learner with flexibility and choice in his/her learning.

The learner will be introduced to three tutorials that are at three levels of difficulty (Novice, Intermediate and Expert) which are followed by an educational activity where he/she can apply coding skills.

Within each tutorial, the learner will have the option of selecting a coding language (Blocks, Javascript or Python).

The learner may choose a tutorial at his/her appropriate difficulty level and language OR choose to complete all tutorials and the educational activity.  It will take approximately an hour to complete all activities.

Guiding Questions:

1. Are there chores you do at your home that you must do in order to earn your allowance?

Example Answers: Make my bed, unload the dishwasher, walk the dog

2. If your parents told you that if you make all A’s, they will give you $50 but you make all A’s and 1 B. Will you get the money? Why or why not?

No, the $50 was on the condition that I got all A’s.

3. In a video game, what are some of the requirements that must be met in order to complete the game?

Accomplish the task within the time limit, follow the rules of the game. 

 

Student Activities

TUTORIAL 1: AGENT MAZE (Novice-5 minutes)

Main objective: The learner will code the agent to find its way through any maze by using chat commands and an if / else loop.

Answer Key: https://makecode.com/_5rLHph15H4YX

TUTORIAL 2: CHOPPING TREES (Intermediate-10 minutes)

Main objective: The learner will use chat commands and loops to code the agent to automatically chop down trees.

Answer key: https://makecode.com/_bHYdKfKCy7Ri

TUTORIAL 3: AGENT PYRAMID (Expert-5 minutes)

Main objective: The learner will use chat commands and loops to code the agent to build a pyramid.

Answer key: https://makecode.com/_ig5Ho3V8LRJg

EDUCATIONAL APPLICATION CASE (15 minutes)

Subject Area: Language Arts

Main purpose of the activity:

  • Practice cause and effect with if statements.  ​
  • Code an if statement that says if a certain crop is planted, a specific animal that likes to eat that crop is spawned.  ​

The learner’s challenge is to use if statements to spawn animals that eat that particular crop. In this world, there are various enclosures that call for a type of plant to be planted and a specific animal to be spawned. The learner will have to read the signs at each enclosure and then write the code using an if statement. (It should be - if the crop is planted, then the specific animal is spawned.)

Outcome of This Activity: The learner will have successfully used if statements to spawn specific plants for a specific animal.

Possible Solution for this Activity: https://makecode.com/_KJoEkh89baVy 

Performance Expectations

Ask the learners about new skills that they have practiced during the activity to reinforce the concepts.

  • What does a Forever loop do?

It makes the code inside the loop repeat forever.

  • What is a Conditional?

It’s a statement that tells a program to do different actions depending on whether a condition is true or false.

  • If the condition of the if portion of the code in an if / else loop is met, will the else portion run?

No. Else will only run if the if portion of the code is not met.

  • Describe a while loop.

A while loop will run the code only while a certain condition is being met.

Skills

  • Creativity
  • Critical Thinking