various docs updates

This commit is contained in:
Peli de Halleux
2016-05-19 13:56:24 -07:00
parent 9a36a2fc05
commit c65bdb34af
10 changed files with 41 additions and 90 deletions

View File

@ -1,23 +1,26 @@
# If
Run code based on a condition.
### @parent blocks/language
Conditionally run code depending on whether a [Boolean](/reference/types/boolean) condition is true or false.
### Block Editor
![](/static/mb/hourofcode-0.png)
```blocks
if(true) {
}
```
In the Block Editor, click on the dark blue gear icon (see above) to add an *else* or *if* to the current block.
### Example: adjusting screen brightness
![](/static/mb/blocks/game-library/pic0.png)
```blocks
if(input.lightLevel()<100){
led.setBrightness(255);
}
```
If the screen [brightness](/reference/led/brightness) is `< 100`, this code sets the brightness to `255`:
If the [light level](/input/light-level) is `< 100`, this code sets the brightness to `255`:
### Lessons