Difference between revisions of "Mixly Block Category - Control"
(→Else) |
(→If... else if... else) |
||
Line 9: | Line 9: | ||
=If... else if... else= | =If... else if... else= | ||
if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. | if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. | ||
+ | |||
+ | '''Else If''' and '''Else''' extensions can be added to the blocks by clicking on the gear icon and dragging '''Else If''' and '''Else''' over. This extends the block. | ||
+ | |||
+ | * '''If''' is the first condition that is checked. If it evaluates to true. Then the contents of the '''If''' are executed. In addition, any '''Else If''' or '''Else''' extensions are skipped. When false, it either either goes to '''Else If''', '''Else''' or to the next block. This is dependent on how the block is configured. | ||
+ | * '''Else If''' is checked after '''If''' or '''Else If''' (above the current one) have been false. When this '''Else If''' is true, then the contents are executed. In addition, any '''Else If''' or '''Else''' extensions are skipped after this one. When false, it either goes to '''Else If''', '''Else''' or to the next block. This is dependent on how the block is configured. | ||
+ | * '''Else''' is checked after '''If''' or the last '''Else If''' have been all false. Contents of '''Else''' will be executed. | ||
+ | |||
==If== | ==If== | ||
The ''''if''' block checks for a condition is true. It will execute the contained blocks if the condition is true. It will skip the contained blocks if the condition is false. | The ''''if''' block checks for a condition is true. It will execute the contained blocks if the condition is true. It will skip the contained blocks if the condition is false. | ||
Line 15: | Line 22: | ||
==Else== | ==Else== | ||
Blocks within the '''else''' occurs when the '''if''' and '''else if''' are never triggered. | Blocks within the '''else''' occurs when the '''if''' and '''else if''' are never triggered. | ||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/If , https://www.arduino.cc/en/Reference/Else | ||
=Switch= | =Switch= |
Revision as of 00:39, 10 February 2017
Contents
Setup
Blocks are called that are contained within the Setup blocks at the start of the device. The setup function will only run once, after each powerup or reset. It is the very start of the program running and used to initialize variables, pin modes, start using libraries, etc.
Read more here: https://www.arduino.cc/en/Reference/Setup
Delay
Pauses the program for the amount of time in milliseconds (ms) or microseconds (μs) specified.
Read more here: https://www.arduino.cc/en/Reference/Delay
If... else if... else
if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number.
Else If and Else extensions can be added to the blocks by clicking on the gear icon and dragging Else If and Else over. This extends the block.
- If is the first condition that is checked. If it evaluates to true. Then the contents of the If are executed. In addition, any Else If or Else extensions are skipped. When false, it either either goes to Else If, Else or to the next block. This is dependent on how the block is configured.
- Else If is checked after If or Else If (above the current one) have been false. When this Else If is true, then the contents are executed. In addition, any Else If or Else extensions are skipped after this one. When false, it either goes to Else If, Else or to the next block. This is dependent on how the block is configured.
- Else is checked after If or the last Else If have been all false. Contents of Else will be executed.
If
The 'if block checks for a condition is true. It will execute the contained blocks if the condition is true. It will skip the contained blocks if the condition is false.
If... Else if
else if checks for a condition is true, but occurs after the if. Multiple else if can be used and the checks occurs sequentially. Contained blocks execute if the condition is true. Contains blocks will skips if the condition is false.
Else
Blocks within the else occurs when the if and else if are never triggered.
Read more here: https://www.arduino.cc/en/Reference/If , https://www.arduino.cc/en/Reference/Else