This preview shows page 1. Sign up to view the full content.
Unformatted text preview: a loop is implemented in Ada, VB.NET, C++, and Java. A while statement, like an if statement, alters the normal sequential flow of a program. The behavior is described in Figure 8.4. Note that an if statement is used to make a choice between two courses of action; the while statement is used to repeat a course of action. Before we look at how different high-level languages express the while statement, lets look at two distinct types of repetitions. Count-controlled loops A count-controlled loop is one that repeats a specified number of times. The looping mechanism simply counts each time the process is repeated, then tests to see if its finished before begin-ning again. There are three distinct parts to this kind of loop, which makes While (there are more names) CASE operator OF + : Set answer to one + two - : Set answer to one two * : Set answer to one * two / : Set answer to one / two...
View Full Document
This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.
- Fall '10