Return to Video

If/Else with the Bee in Code Studio

  • 0:05 - 0:11
    We have a new block that's called the if/else
    block. It's a conditional statement just like
  • 0:11 - 0:16
    the if block you've used in the puzzles before.
    But now there's a new part at the bottom that
  • 0:16 - 0:23
    says else. The if/else block lets the bee
    make a decision between two sets of actions.
  • 0:23 - 0:28
    If the bee is at a flower, the bee will do
    the set of actions you put in the first part
  • 0:28 - 0:34
    where it says do. If the bee is not at a flower,
    the bee will do the set of actions you put
  • 0:34 - 0:42
    in the slot where it says else. If statements
    are how computers are able to make decisions.
  • 0:42 - 0:47
    Humans set up conditions for the computer
    that say if the computer is presented with
  • 0:47 - 0:55
    a certain situation do this. Else, which just
    means otherwise, do that. The top of our if/else
  • 0:55 - 1:02
    block says if at flower. But the top of our
    block could say other things, like if nectar
  • 1:02 - 1:08
    equals 2 or if there's a path ahead, our block
    will behave in the same way. That if the statement
  • 1:08 - 1:13
    at the top is true it will do the first set
    of actions. But if the statement at the top
  • 1:13 - 1:16
    is false, it will do the second set of actions.
Title:
If/Else with the Bee in Code Studio
Video Language:
English
Team:
Code.org
Project:
CSF '21-'22
Duration:
01:18

English subtitles

Revisions Compare revisions