a. if Statement:
Executes a block of code if a specified condition is true.
javascript var x = 10; if (x > 5) { console.log("x is greater than 5"); }
b. if...else Statement:
- Executes one block of code if a specified condition is true, and another block of code if the condition is false.
javascript var x = 10; if (x > 5) { console.log("x is greater than 5"); } else { console.log("x is less than or equal to 5"); }
c. else if Statement:
- Allows you to check multiple conditions and execute a different block of code for each condition.
javascript var x = 10; if (x > 10) { console.log("x is greater than 10"); } else if (x < 10) { console.log("x is less than 10"); } else { console.log("x is equal to 10"); }
Thanks for learning