DEV Community

Sunnat Qayumov
Sunnat Qayumov

Posted on

14. Loops (Advanced)

a) break va continue operatorlari qanday ishlatiladi? Misol keltiring.

break toxtatadi;
continue davom etadi;
Enter fullscreen mode Exit fullscreen mode

b) Quyidagi kod qanday ishlaydi?

for (int i = 0; i < 5; i++)
{
    if (i == 3)
    {
        continue;
        Console.WriteLine(i);
    }
}
Enter fullscreen mode Exit fullscreen mode

Javob: for sikli i ni 0 dan 4 gacha (5 gacha emas)
oshiradi.if (i == 3) sharti tekshiriladi.
Agar i 3 ga teng bo‘lsa, continue operatori
ishga tushadi, va bu holatda Console.WriteLine(i);

Top comments (0)