COP 2510 Study Guide - Comprehensive Midterm Guide: Unary Operation, Negation, Infinite Loop
Document Summary
Flow of control refers to the order of statement execution. Linear (one statement after another in sequence) Selective (choose whether to execute a particular statement) Repetitive (choose to execute a statement over and over) Decisions are based on boolean expressions or conditions. Recall: conditions evaluate to true and false. == equal to (don"t confuse with =) Boolean expressions can also use logical operators. Logical not is unary operator (uses one operand) Logical and and logical or are binary operators (uses two operands) If condition a is true, then !a is false; If a is false, then !a is true. The logical and expression: a && b. Is true if both a and b are true, and false otherwise. The logical or expression: a b. Is true if a or b or both are true, and false otherwise. Logical operators can be described using a truth table: B true true true false false false false.