Repetition and Looping
An Introduction with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
while
Loops (cont.)
while
Loops (cont.)do-while
Loops (cont.)
do-while
Loops (cont.)for
Loops (cont.)
for
Loops (cont.)for
Loops (cont.)for
loopsfor (j=0; j<50; ++j)
for (int i=0; i<50; ++i)
i
and j
j
can be accessed outside of the
loop, i
can'tage = age + 1;
)age += 1;
)for
loop can be provided a
range of integers using the range()
functionfor
loop can be provided a
list/array/stringdo
loop