16-11-2012, 06:23 PM
Control Structures
Control Structures.ppt (Size: 546.5 KB / Downloads: 25)
Introduction
Continue structured-programming discussion
Essentials of Counter-Controlled Repetition
Counter-controlled repetition requires:
Control variable (loop counter)
Initial value of the control variable
Increment/decrement of control variable through each loop
Condition that tests for the final value of the control variable
break and continue Statements
break/continue
Alter flow of control
break statement
Causes immediate exit from control structure
Used in while, for, do…while or switch statements
continue statement
Skips remaining statements in loop body
Proceeds to next iteration
Used in while, for or do…while statements
Structured Programming Summary
Sequence structure
“built-in” to Java
Selection structure
if, if…else and switch
Repetition structure
while, do…while and for