Conditional statements execute if and only if a certain condition or conditions are true. They generally come in three forms: if statements, case statements, and logical AND/OR statements.
if statements test numerical expressions. If the condition is true the statements inside the if block are executed. If the statement is false, one of two things can happen:
Nothing. The statements inside the if block are not executed, and the program continues as if they were not even there.
If an else statement is included inside the if block, these statements will be executed if the condition is false. In other words, this can be used to write “Do this if the condition is true, or do this if the condition is false, but ...
Get FreeBSD® Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.