Introduction
An if statement helps your program decide what to do based on a condition. It lets your program choose different paths, like making a choice in real life.
When you want to check if a number is positive or negative and do something different for each.
When you want to check if a user entered the correct password before allowing access.
When you want to decide what message to show based on the time of day.
When you want to perform an action only if a button is clicked.
When you want to check if a list is empty before processing it.