Migrate docs from the other repo
This commit is contained in:
29
docs/reference/logic/if.md
Normal file
29
docs/reference/logic/if.md
Normal file
@ -0,0 +1,29 @@
|
||||
# If
|
||||
|
||||
Run code based on a condition. #docs #if #then #else #endif #language #elseif
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
|
||||
Conditionally run code depending on whether a [Boolean](/microbit/reference/types/boolean) condition is true or false.
|
||||
|
||||
### Block Editor
|
||||
|
||||

|
||||
|
||||
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
|
||||
|
||||

|
||||
|
||||
If the screen [brightness](/microbit/reference/led/brightness) is `< 100`, this code sets the brightness to `255`:
|
||||
|
||||
### Lessons
|
||||
|
||||
[love meter](/microbit/lessons/love-meter), [zoomer](/microbit/lessons/zoomer)
|
||||
|
||||
### See also
|
||||
|
||||
[while loop](/microbit/reference/loops/while), [for](/microbit/reference/loops/for), [boolean](/microbit/reference/types/boolean)
|
||||
|
Reference in New Issue
Block a user