Game Preview

break & continue

  •  English    7     Public
    game
  •   Study   Slideshow
  • How many times will this while loop print "Yay!"?
    3 times
  •  15
  • What numbers will this for loop print?
    0, 1, 2
  •  15
  • What happens if the condition for a while loop is always true?
    The loop runs forever.
  •  15
  • What does the break keyword do in a loop?
    It stops the loop completely, no matter what.
  •  15
  • What does the continue keyword do in a loop?
    It skips the rest of the code for the current turn and goes to the next turn of the loop.
  •  15
  • What will this code print?
    1 2
  •  15
  • What is the most important thing to remember when writing a while loop?
    You need to make sure the loop's condition will eventually become False
  •  15