READING Chapter 6 Section 2 "Pitfalls in Writing Repetition Statements" - infinite loop: loops that never terminates - overflow error: assign a variable a value bigger than it's data type's maximum - for reals, Java assigns a value representing infinity - for integers, value "wraps around" and starts counting from the minimum again - using real numbers for testing and increment - only an approximation of real numbers can be stored in a computer - avoid because approximation makes non-deterministic - off-by-one error - to make a loop execute N times - initialize the counter to 0 and use < N - initialize the counter to 1 and use <= N - shorthand assignment operators - a op= b; - equivalent to a = a op b; - +=, -=, *=, /=, %= - precedence lower than arithmetic operators Quick Check: 1. a. is infinite because we start with 0 and keep increasing i, but only test for i >= 0 b. is not infinite because we start i at 100 and decrement it in increments of 1; this is poor style, however, since if we changed the decrement increment, it might easily become an infinite loop 2. a. sum == 1 + 2 + ... + 9 == 45 b. count: 1, 4, 7, 10, 13, ... 31 sum: 1, 5, 12, ... , 145 c. count: 0, 2, 4, 6, ... 20 sum: 0, 6, 18, 36, ... 270