lesson updates
This commit is contained in:
@ -24,7 +24,7 @@ We create a **variable**, `count` to keep track of the current count. The number
|
||||
|
||||
```blocks
|
||||
let count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count, 150)
|
||||
})
|
||||
@ -40,7 +40,7 @@ We are only pressing on button pressed once. So the number to display on the mic
|
||||
|
||||
```blocks
|
||||
count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
|
@ -28,7 +28,7 @@ let count = 0
|
||||
|
||||
```blocks
|
||||
let count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
@ -42,7 +42,7 @@ input.onButtonPressed("A", () => {
|
||||
|
||||
```blocks
|
||||
count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
|
@ -12,27 +12,28 @@ Answers may vary. Generally, on button pressed run code when an input button is
|
||||
|
||||
Write the line of code that creates a condition when the BBC micro:bit button A is pressed.
|
||||
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
})
|
||||
```
|
||||
|
||||
## 3. Consider the following directions
|
||||
## 3. Write the line of code that creates a **local variable** and a **random number**.
|
||||
|
||||
|
||||
|
||||
Write the line of code that creates a **local variable** and a **random number**.
|
||||
|
||||
```blocks
|
||||
let randomNumber = Math.random(10)
|
||||
```
|
||||
|
||||
## 4. Consider the following code
|
||||
## 4.
|
||||
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
|
||||
|
||||
```blocks
|
||||
randomNumber = Math.random(10)
|
||||
```
|
||||
|
||||
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
|
||||
|
||||

|
||||
|
||||
|
Reference in New Issue
Block a user