Introduction
An if statement helps your program decide what to do based on a condition. It lets your code choose between different paths.
When you want to check if a user is logged in before showing a page.
When you want to give a discount only if the purchase amount is over a certain value.
When you want to show a message if a form field is empty.
When you want to run different code depending on the time of day.