In our last session, we saw how if statements run code only when a condition is true. Like checking age >= 18 before printing "You can vote!".
But what if the condition is false.
Engagement Message
What should the program do then?
Often, we want to provide an alternative action when the if condition isn't met. This is where the else statement comes in handy! It specifies code to run only when the if condition evaluates to false.
Think of it as the "otherwise" part of a decision.
Engagement Message
Make sense?
The else statement always follows an if block. It has its own block of code wrapped in curly braces {}. It doesn't need its own condition because it catches everything the if didn't.
