conditional
This commit is contained in:
parent
ce935cfc33
commit
8aaa3b599f
34
1.Basics.md
34
1.Basics.md
@ -155,3 +155,37 @@ function draw() {
|
||||
|
||||
// Reference: https://p5js.org/reference/
|
||||
```
|
||||
|
||||
## 🤔 What are conditional statements (i.e. if-statements)?
|
||||
|
||||
```javascript
|
||||
if(conditionX) {
|
||||
// if conditionX is true then
|
||||
// execute this piece of code {} block
|
||||
// then exit the if/else statement
|
||||
} else if(conditionY) {
|
||||
// if conditionX is false then
|
||||
// if conditionY is true then
|
||||
// execute this piece of code {} block
|
||||
// then exit the if/else statement
|
||||
} else if(conditionZ) {
|
||||
// if conditionX and conditionY are false then
|
||||
// if conditionZ is true then
|
||||
// execute this piece of code {} block
|
||||
// then exit the if/else statement
|
||||
} else {
|
||||
// if all of the above conditions are false then
|
||||
// execute this piece of code {} block
|
||||
// then exit the if/else statement
|
||||
}
|
||||
```
|
||||
|
||||
Ok ok, but what are "conditions" then?
|
||||
|
||||
<p align="center">
|
||||
<img src="https://git.le-club-des-sans-sujets.org/gauthiier/Revisiting-Concepts-Notations-Software-Art/media/branch/main/img/comparing-operators.png" height="450"/>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user