O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recap

For simple condition testing, the if/else statements provide a way to selectively execute code based on one or more conditions. These conditions can be a test of a single value against a variable, two variables, or complex compound statements combined with Boolean logic. The code is executed only if the condition evaluates to true; the final outcome is binary in nature.

Nesting of if statements is allowed, allowing you to build up several depths of decision making rather than having too many complex compound conditions. You can also have multiple single-level if statements within another if statement code block, allowing you to select between values.

The else if mechanism allows for the possibility to test another value in case the original ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required