diff --git a/1.Basics.md b/1.Basics.md index 51a90d0..eec7b36 100644 --- a/1.Basics.md +++ b/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? + +

+ +

+ + + +