Merge pull request #180 from Microsoft/snippetfixes
Fixes to documentation snippets
This commit is contained in:
commit
3f241e8bc9
@ -86,7 +86,7 @@ if (led.point(1,1) && led.point(2,2)) {
|
||||
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:
|
||||
|
||||
```blocks
|
||||
let x = math.random(5)
|
||||
let x = Math.random(5)
|
||||
if(x < 5) {
|
||||
basic.showString("low");
|
||||
} else {
|
||||
|
@ -5,7 +5,7 @@
|
||||
Your beginning code should look like this:
|
||||
|
||||
```blocks
|
||||
let coll = (<string[]>[])
|
||||
let coll: string[] = []
|
||||
coll.push("puppy")
|
||||
coll.push("clock")
|
||||
coll.push("night")
|
||||
@ -27,7 +27,7 @@ game.startCountdown(30000)
|
||||
Let's add more words for the player to act out! But first, we need to increase the time in one round to give the player more time get through all the words. Let's change the `game->start countdown` statement.
|
||||
|
||||
```blocks
|
||||
let coll = (<string[]>[])
|
||||
let coll: string[] = []
|
||||
coll.push("puppy")
|
||||
coll.push("clock")
|
||||
coll.push("night")
|
||||
@ -52,7 +52,8 @@ game.startCountdown(60000)
|
||||
Now let's add 5 more words to our list of charade words. Right above the the line `word:=coll->at(index)` add 5 lines that say `coll->add("")`. In this example, we will add the words **bicycle, telephone, sun, car, and ant** but you can add whatever words you like.
|
||||
|
||||
```blocks
|
||||
let coll.push("puppy")
|
||||
let coll: string[] = []
|
||||
coll.push("puppy")
|
||||
coll.push("clock")
|
||||
coll.push("night")
|
||||
coll.push("cat")
|
||||
|
@ -19,7 +19,7 @@ A 'collection' is a group of variables of the same type stored together. A 'coll
|
||||
## 2. Consider the following lines of code.
|
||||
|
||||
```blocks
|
||||
let coll = (<string[]>[])
|
||||
let coll: string[] = []
|
||||
coll.push("puppy")
|
||||
coll.push("clock")
|
||||
```
|
||||
@ -35,7 +35,7 @@ basic.showString(coll[0], 150)
|
||||
## 3. Consider the following lines of code.
|
||||
|
||||
```blocks
|
||||
let coll = (<string[]>[])
|
||||
let coll: string[] = []
|
||||
coll.push("puppy")
|
||||
coll.push("clock")
|
||||
coll.push("cat")
|
||||
@ -52,7 +52,7 @@ basic.showString(coll[2], 150)
|
||||
## 4. Consider the following line of code.
|
||||
|
||||
```blocks
|
||||
let coll = (<string[]>[])
|
||||
let coll: string[] = []
|
||||
```
|
||||
|
||||
Write the five (5) lines of code that will add the following five words to `data->coll`: puppy, clock, night, cat, cow.
|
||||
@ -60,7 +60,8 @@ Write the five (5) lines of code that will add the following five words to `data
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
let coll.push("puppy")
|
||||
let coll: string[] = []
|
||||
coll.push("puppy")
|
||||
coll.push("clock")
|
||||
coll.push("night")
|
||||
coll.push("cat")
|
||||
|
@ -211,7 +211,7 @@ Let's setup the logic for the food and the ghost to be in different quadrants. F
|
||||
let hero = game.createSprite(2, 2);
|
||||
let food = game.createSprite(4, 4);
|
||||
let ghost = game.createSprite(0, 0);
|
||||
let ghost.change(LedSpriteProperty.Blink, 100);
|
||||
ghost.change(LedSpriteProperty.Blink, 100);
|
||||
food = led.brightness() == 8;
|
||||
while (true) {
|
||||
basic.pause(400);
|
||||
@ -265,7 +265,7 @@ while (true) {
|
||||
}
|
||||
|
||||
}
|
||||
0.set(LedSpriteProperty.X, 4);
|
||||
ghost.set(LedSpriteProperty.X, 4);
|
||||
|
||||
|
||||
```
|
||||
|
@ -3,11 +3,11 @@
|
||||
Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](/device/screen). NOTE: `basic -> plot image` has been replaced by `basic -> show leds`.
|
||||
|
||||
```sig
|
||||
basic.plotLeds(`
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . # . .
|
||||
# ; . . #
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
```
|
||||
@ -16,14 +16,14 @@ basic.plotLeds(`
|
||||
|
||||
* leds - a series of LED on/off states that form an image (see steps below)
|
||||
|
||||
### Example: simley
|
||||
### Example: smiley
|
||||
|
||||
```blocks
|
||||
basic.plotLeds(`
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . # . .
|
||||
# ; . . #
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
```
|
||||
|
@ -61,7 +61,7 @@ The [math library](/blocks/math) includes math related functions.
|
||||
For example, the `absolute` function returns the returns the absolute value of input parameter `x`:
|
||||
|
||||
```blocks
|
||||
let abs = math.absolute(-42);
|
||||
let abs = Math.abs(-42);
|
||||
basic.showNumber(abs);
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user