DEV Community

umida5
umida5

Posted on

for Loop

  1. - continue siklni to‘xtatmay, faqat keyingi iteratsiyaga o‘tadi:
for(int i = 0; i < 5; i++)
{
    if(i == 2)
    {
        continue; // 2 ni chiqarib yuboradi
    }
    Console.WriteLine(i);
}
Enter fullscreen mode Exit fullscreen mode

Natija :

0
1
3
4

2.

for(int i = 1;i < 10;i++)
{
   if(i % 2 == 0)
   {
     Console.WriteLine(i);
   }
}
Enter fullscreen mode Exit fullscreen mode

Output: 2,4,6,8 alohida qatorlarda

Top comments (0)