AllTheTimeWorld.com

csharp loopsIntroduction to do Loops

Introduction to do Loops

A do loop always executes at least once.

Introduction to do Loops

A do loop always executes at least once.


Text of video

A do loop always executes at least once because the test is at the end.

//Add numbers 1, 2, 3 to list box, with DO loop
int num = 0;
do
{
   num++;
   lstNumbers.Items.Add(num);
} while (num <3);