READING Chapter 5 Section 3 - then and else blocks can include any kind of statement, including more if statements - nested-if statement: if statement within the then or else block of another if statement - possible to write if tests in different ways to achieve the same result - choose most readable and efficient - increment operator - increases the value of the operand by 1 - syntax: ++ - decrement operator - decreases the value of the operand by 1 - syntax: -- - apply nested-if structure if need to test conditions in some required order - indent the then and else blocks to show the nested structure clearly - visual guide for readers - not required for compilation - proper indentation important aspect of good programming style - standard indentation for a series of else if if ... ... else if ... ... ... else if ... ... else ... - dangling else problem - Java compiler matches else with the previous unmatched if - good reason to always use brackets around then and else blocks Quick Check 1. a. if ( a < c && b < c ) x = y; if ( (a < c && b >= c) || a >= c ) x = z; b. if ( a >= b ) x = y; else x = z; c. if ( a < b ) x = y; else x = z; 2. a. if ( a < b ) if ( c > d ) x = y; else x = z; b. if ( a < b ) { if ( c > d ) x = y; } c. if ( a < b ) x = y; if ( a < c ) x = z; else if ( c < d ) z = y;