pxt-calliope/docs/reference/js/lessons/jailbreak/quiz.md

35 lines
1.0 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# jailbreak quiz
2016-04-02 01:22:47 +02:00
break out of a counting loop by pressing button "A".
2016-03-26 00:47:20 +01:00
## Name
## Directions
Use this activity document to guide your work in the [jailbreak tutorial](/microbit/lessons/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.
<br/>
## 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).
<br/>
## 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 **
<br />
<br/>