while

Similar to the for loop, a condition is evaluated before we execute the code block. This means that the code block is either executed more than once or not executed at all. Just like any other loop, you can come out of the loop using the break, continue, return, or throw statements:

int n = 0;
while (n < 5)
{
Console.WriteLine(n);
n++;
}
//output
0
1
2
3
4
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.68