35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
|
# jailbreak quiz
|
||
|
|
||
|
break out of a counting loop by pressing button "A" #break #string #variables #docs
|
||
|
|
||
|
## 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/>
|
||
|
|