LECTURE OCTOBER 13 2004 ASSIGNMENTS - Fri 10/15 CodeLab 6 - Mon 10/18 Assignment 2 MORE TYPES OF LOOPS What? - *pretest loop* - loop body executed 0 or more times How? - while loop What? - *posttest loop* - loop body exected 1 or more times How? - do-while loop DO-WHILE LOOP What? - syntax How? - do while ( ); What? - How? - one or more statements (multiple require brackets) - executed until is false What? - control-flow diagram How? - arrow into preceding code block rectangle - arrow into loop body rectangle - arrow into loop condition diamond - false arrow - true arrow to above loop body rectangle What? - good style How? - don't duplicate the loop test inside the loop - use a boolean to represent repeated conditions (especially if any of multiple) What? - while versus do-while - while generally more frequently used