{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# summary03 - Chapter 7.2 Multiway Branches • Branching...

This preview shows pages 1–2. Sign up to view the full content.

Truth Tables: if ( ( 6 < 4 ) && (10 > 2 )) if ( (false ) && (true)) if (false ) Summary Ch 7.1 – 7.2 Chapter 7.1: Using Boolean Expressions Boolean Values – true/false, use relational and boolean operations (==, && ||, !) And (&&) T T T T F F F T F F F F Or (||) T T T T F T F T T F F F Not (!) T F F T Short-circuit evaluation- if the first part of the statement is false, and it is an && statement, it skips the second part of the statement, whereas complete evaluation completes all statements, even if the first is false. Enumeration Types- can specify values for multiple constants – automatically assigns consecutive values beginning w/ 0 Enum MonthLength { NORTH = 0, SOUTH = 1, EAST = 2, WEST = 3};

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 7.2 Multiway Branches • Branching Mechanism- chooses one from a number of alternative actions o If-else o If o While o Do-while • Make sure you use braces to specify where one if statement ends and another begins • Can use else if instead of indenting on another line and simplifying the code. • Use switch statement to execute one of a number of cases • Break statement to end the switch • Default section to use any other possible answers • Use functions to simplify code • Can have blocks with variable declarations local to the compound statement...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

summary03 - Chapter 7.2 Multiway Branches • Branching...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online