pxt-calliope/docs/lessons/rotation-animation/quiz.md
2016-03-29 15:21:17 -07:00

1014 B

rotation animation quiz

Learn how to create a rotating image with a while loop. #image #loop #while #docs

Name

Directions

Use this activity document to guide your work in the rotation animation tutorial.

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

1. What is a "global variable"?


2. Write the code to create a global variable called foo that stores a boolean and initialize it to false.


3. Explain why you use a while loop with a global variable

while (rotating) {
}

4. Draw the areas on the micro:bits to illustrate the code below. Explain why you chose to draw in those areas.

basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)