Zoom
  • Here is the same code as the previous page except this time sky_is_blue is False
  • Now notice lines 4 and 5 get skipped and line 7 is executed.
  • Line 7 is part of the 'else'. The 'else' part of an If-statement gets executed when the If-statement is false.
  • In this example, sky_is_blue is False. So the 'else' part is executed.
  • If-statements let you choose what to execute.
  • This is how you can control the flow of execution!