pxt-calliope/docs/reference/logic/if.md
2016-03-25 16:47:20 -07:00

844 B

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 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 is < 100, this code sets the brightness to 255:

Lessons

love meter, zoomer

See also

while loop, for, boolean