LESSON 10

GOAL: Students will be able to…

  1. Use conditions to gather information about Karel’s world (is the front clear, is Karel facing north, etc)
  2. Create if statements to only execute code if a certain condition is true

VOCAB: 

  1. ConditionA condition is code that you put inside an if statement or while-loop.
  2. If Statement–An if statement lets you ask a question to the program and only run code if the answer is true.
  3. Control Structure–A control structure lets us change the flow of the code.
  4. Parentheses–( and )

DO THE FOLLOWING IN ORDER:

  1. REVIEW:
    1. Do  1.9.2 For Loops Quiz
    2. Complete the For Loops handout individually or in pairs.
  2. What determines what time you will go to bed? What determines when you will ask for help in class? What determines when you eat birthday cake? Point out the condition in each of the If statements on the board. Identify what code is executed if the condition is true.
  3. Watch  1.10.1 If Statements
  4. Look at  1.10.3 If Statements by comparing and contrasting what occurs to Karel when the start function is initialized.
    1. Why do you think Karel crashed when the start function is initialized?
  5. Examine 1.10.4 Safe Take Ball example in pairs or individually.
  6. Do & show me  1.10.5 Is There a Ball? individually or in pairs.
  7. FYI: CodeHS Online Textbook–use this as a resource
  8. BEFORE YOU LEAVE, WRITE ABOUT THE FOLLOWING in the Word Online file named Web Apps & Coding for this class (you will write in this file daily):
    1. Write if statements for real life scenarios. Examples include:
if (zombiesPresent()){
    runAndHide();
}

if (favoriteSongOnPandora()){
    dance();
}

Leave a comment

Your email address will not be published. Required fields are marked *