40 lines
433 B
Markdown
40 lines
433 B
Markdown
# Logic
|
|
|
|
[if](/microbit/reference/logic/if)
|
|
|
|
```blocks
|
|
if(true) {
|
|
}
|
|
```
|
|
|
|
[Boolean](/microbit/reference/types/boolean) values: *true*; *false*
|
|
|
|
```blocks
|
|
true
|
|
false
|
|
```
|
|
|
|
Boolean binary operators: *and* (conjunction); *or* (disjunction)
|
|
|
|
```blocks
|
|
true && false;
|
|
true || false;
|
|
```
|
|
|
|
Boolean negation operator
|
|
|
|
```blocks
|
|
!true
|
|
```
|
|
|
|
Comparison operators (=, !=, <, >, <=, >=)
|
|
|
|
```blocks
|
|
0 == 0;
|
|
1 !- 0;
|
|
0 < 1;
|
|
1 > 0;
|
|
0 <= 1;
|
|
1 >= 0;
|
|
```
|