pxt-calliope/docs/lessons/rotation-animation/quiz.md
Michael Elliot Braun ba6c9f9d92 updating lesson links
2016-03-30 16:10:27 -07:00

1.5 KiB

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 " variable"?


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


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

let rotating = true;
while (rotating) {
    basic.showLeds(`
        . . . . .
        . . . . .
        . . # . .
        . . . . .
        . . . . .
        `)
    basic.showLeds(`
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        `)
}


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

basic.showLeds(`
        . . # . .
        . . # . .
        . . # . .
        . . # . .
        . . # . .
        `)
basic.showLeds(`
        . . . . .
        . . . . .
        # # # # #
        . . . . .
        . . . . .
        `)
basic.showLeds(`
        . . . . #
        . . . # .
        . . # . .
        . # . . .
        # . . . .
        `)
basic.showLeds(`
        . . . . #
        . . . # .
        . . # . .
        . # . . .
        # . . . .
        `)