Loops(Advanced)
umida5
Posted on October 14, 2024
break
va continue
operatorlari
for
siklida break
va continue
operatorlari yordamida siklni to‘xtatish yoki keyingi iteratsiyaga o‘tish mumkin.
-
break
siklni butunlay to‘xtatadi:
for(int i = 0; i < 10; i++)
{
if(i == 5)
{
break; // 5 ga yetganda sikl to‘xtaydi
}
Console.WriteLine(i);
}
-
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);
}
💖 💪 🙅 🚩
umida5
Posted on October 14, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.