pxt-calliope/docs/reference/js/lessons/jailbreak/quiz.md
2016-04-01 16:22:47 -07:00

1.0 KiB

jailbreak quiz

break out of a counting loop by pressing button "A".

Name

Directions

Use this activity document to guide your work in the jailbreak tutorial

Answer the questions while completing the tutorial. Pay attention to the dialogues!

1. What does a 'break' statement do to a 'loop' ?

2. Consider the following directions

Write the line of code that will initialize a number variable to 0. Then create a second variable that tells us when we should break out of the loop. Set the break to false.


3. Consider the following directions

Write the line of code to stop incrementing count when the button is pressed. (Hint: This will set should break to true).


4. Consider the following directions

Add an if statement to determine whether or not we should break out of the loop. Then include the message "I'm Out!" and a smiley face image displayed. This will happen right before you break from the while loop. **Do not include the break **