-
An if-else statement is a decision between
two things. For example, IF Scrat the squirrel
-
finds the acorn, then he's happy. ELSE he's
sad, and keeps searching. Now let's see how
-
we can use an if-else statement with our buddy
Scrat. This block looks the same as the "if"
-
block, but there's an extra part on the bottom
that says "else". If I put a "move forward"
-
block where it says "do" and a "turn left"
block where it says "else", that means Scrat
-
the squirrel will move forward if there's
a path ahead. If there's not a path ahead,
-
Scrat will turn left. It's making a decision
and doing one of the two actions based on
-
that decision. And just like "if" blocks,
you can put "if-else" blocks inside "repeat"
-
blocks. Now let's help Scrat the squirrel
get that acorn!