+ Do
   - Đối với do thường đi với while hay còn gọi vòng lặp do-while thực thi các tuyên bố trong dấu ngoặc {} đến khi điều kiện trong while() thì sẽ kết thúc.

Xem mã sau: 

public class TestDoWhile 
{
public static void Main ()
{
int x = 0;
do
{
Console.WriteLine(x);
x++;
} while (x < 5); // chú ý dấu ';' là bắt buộc
}
}
/*
Output:
0
1
2
3
4
*/


+ While
   -  Nó thực thi các tuyên bố trong dấu {} đến khi gặp điều kiện thì chấm dứt.


class WhileTest 
{
static void Main()
{
int n = 1;
while (n < 6)
{
Console.WriteLine("Current value of n is {0}", n);
n++;
}
}
}
/*
Output:
Current value of n is 1
Current value of n is 2
Current value of n is 3
Current value of n is 4
Current value of n is 5
*/
 

thumbnail 016. Keyword [do] [while]

data:label.name author

premiumpng.com

Design Publisher

Download 0
No comments
Template in .PSD format

MR Laboratory License

Free for personal purpose use . More info


Buy Now This Template

No comments:

Post a Comment

Commets Download Photoshop Actions, Lightroom Presets, PSD Template, Mockups, Stocks, Vectors, Fonts. Download free

Newer Post Older Post Home

Copyright © 2021 MR Laboratory All rights reserved.

Setting