add examples to 'for of' and 'repeat' (#1794)

This commit is contained in:
Galen Nickel 2019-01-18 07:52:48 -08:00 коммит произвёл Peli de Halleux
Родитель 45e85cba6d
Коммит f461f4ee4c
2 изменённых файлов: 36 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,20 @@
# @extends
## #examples
## Example: Find the highest number
Find the highest number in a list of numbers. Display the highest number on the screen.
```blocks
let list: number[] = []
let highest = 0
highest = 0
list = [5, 8, 6, 2, 4, 3, 7, 1]
for (let value of list) {
if (value > highest) {
highest = value
}
}
basic.showNumber(highest)
```

Просмотреть файл

@ -0,0 +1,16 @@
# @extends
## #examples
## Example: Blinking heart
Flash the ``heart`` icon on the screen `4` times.
```blocks
for (let i = 0; i < 4; i++) {
basic.showIcon(IconNames.Heart)
basic.pause(300)
basic.clearScreen()
basic.pause(300)
}
```