pxt-calliope/docs/lessons/speed-button/quiz-answers.md
2016-11-01 10:42:42 -07:00

1.3 KiB

speed button quiz answers

counter that keeps track of how many times button "A" has been pressed.

This is the answer key for the speed button quiz.

1. What is a variable?


A variable that is available throughout your main function.

2. If the rectangle below represents the @boardname@, shade the area that shows the value of the variable count.

let count = 0

3. If the rectangle below represents the @boardname@, shade the areas that will be displayed after two button presses on Button A. Explain why that particular area is shaded.

let count = 0
input.onButtonPressed(Button.A, () => {
    count = count + 1
    basic.showNumber(count, 100)
})

After two button presses, count will be equal to 2.

5. If the rectangle below represents the @boardname@, shade the areas that will be displayed after five button presses on Button A. Explain why that particular area is shaded.

let count = 0
input.onButtonPressed(Button.A, () => {
    count = count + 1
    basic.showNumber(count, 100)
})

After five button presses, count will be equal to 5.