# The DO keyword.

The do keyword performs a simular function to while. Basicaly, it repeats a block of statements. Here is an example of the syntax:

            main()
            {
              int i=5;

              do
              {
                printf(" i is %d\n", i);
              }
              while(--i);
            }

The program result will look like this:

     		i is 5
     		i is 4
     		i is 3
     		i is 2
     		i is 1

The main difference between do and while is the time that expression is evaluated.

- do performs the first test AFTER the first iteration.
- while performs the first test BEFORE the first iteration.

## Examples:

Basic do.

## See also:

- while keyword.
- for keyword.
- break keyword.
- continue keyword.

Top | Master Index | Keywords | Functions