August 2008
Beginner to intermediate
304 pages
6h 2m
English
• While loops
• Break, continue, goto
• If, else, switch
Conditional branching operations are a basic feature of any program. These must be properly organized so that the program structure is maintained and confusion avoided. The program then is easy to understand and more readily modified and upgraded.
The basic while (condition) provides a logical test at the start of a loop, and the statement block is executed only if the condition is true. It may, however, be desirable that the loop block be executed at least once, particularly if the test condition is affected within the loop. This option is provided by the do..while(condition) syntax. The difference between these alternatives is illustrated in Figure ...