©1994-2003 Kevin Boone
Home     Section index     K-Zone home C++ tutorial (under construction)

Site search

Glossary
Confused by computer jargon? Look it up!

Shameless plug


Now available!

Articles
- Ten-minute guide to setting up a WAP site

- Talk like your boss: new developments in managerese

More...

Development
File handling in the Linux kernel

Java development for the Sony-Ericsson P800

SunONE Application Server 7 FAQ

More...

Linux
Using Linux with the Treo 600

- Linux on the Tecra M1

- Some notes on openzaurus

More...

Download
Java stuff

Linux stuff

More...

(Please read the download policy)

Home automation
The X10 system

Linux TW723 driver

More...

The K-Zone
K-Zone computing

K-Zone law

K-Zone education and science

K-Zone motorcycles

K-Zone DIY

K-Zone railways

K-Zone martial arts

About the author

K-Zone home page

 
while
contents
for
C++ tutorial: do


The 'do' loop is always executed at least once
The basic structure of the do...while loop is as follows:

do
     {
     statment1;
     statment2;
	// more statements...
     } while (condition)

It works in much the same way as the 'while' loop, except that the test is at the end of the loop, not the start. In my experience, the do...while loop is used less often that the 'while' and 'for' loops. However, it is the natural loop to use when the 'condition' depends on the result of some calculation performed inside the loop.