7.5. Omitting the else Clause: Unary SelectionΒΆ

Another form of the if statement is one in which the else clause is omitted entirely. This creates what is sometimes called unary selection. In this case, when the condition evaluates to True, the statements are executed. Otherwise the flow of execution continues to the statement after the body of the if.

What would be printed if the value of x is negative? Try it.

Check your understanding

Next Section - 7.6. Nested conditionals