Return to Video

Saloni teaches If-Else statements with Scrat the Squirrel from Ice Age

  • 0:00 - 0:06
    An if-else statement is a decision between
    two things. For example, IF Scrat the squirrel
  • 0:06 - 0:12
    finds the acorn, then he's happy. ELSE he's
    sad, and keeps searching. Now let's see how
  • 0:12 - 0:17
    we can use an if-else statement with our buddy
    Scrat. This block looks the same as the "if"
  • 0:17 - 0:22
    block, but there's an extra part on the bottom
    that says "else". If I put a "move forward"
  • 0:22 - 0:27
    block where it says "do" and a "turn left"
    block where it says "else", that means Scrat
  • 0:27 - 0:32
    the squirrel will move forward if there's
    a path ahead. If there's not a path ahead,
  • 0:32 - 0:37
    Scrat will turn left. It's making a decision
    and doing one of the two actions based on
  • 0:37 - 0:42
    that decision. And just like "if" blocks,
    you can put "if-else" blocks inside "repeat"
  • 0:42 - 0:46
    blocks. Now let's help Scrat the squirrel
    get that acorn!
Title:
Saloni teaches If-Else statements with Scrat the Squirrel from Ice Age
Description:

more » « less
Video Language:
English
Team:
Code.org
Project:
Hour of Code
Duration:
0:50

English subtitles

Revisions