do...while iteration statement. - CSharp Language Basics

CSharp examples for Language Basics:do while

Description

do...while iteration statement.

Demo Code

using System;/*ww  w  . j  av a2 s.c  o  m*/
class DoWhileTest
{
   static void Main()
   {
      int counter = 1; // initialize counter
      do
      {
         Console.Write($"{counter}  ");
         ++counter;
      } while (counter <= 10); // required semicolon
      Console.WriteLine();
   }
}

Result


Related Tutorials