If statements are used when you want to make a choice to execute code based on the result of a comparison expression.
To make this work, you evaluate an expression that uses comparison and logical operators to yield a true or false result. If you evaluate an expression to be true, then you can execute the code; otherwise, you can ignore the code.