DEV Community

Mushtariy
Mushtariy

Posted on

For Loop

a) for loopda break operatori ganday ishlatiladi? Misol keltiring.

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

b) Quyidagi kod natijasini tushuntiring.

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

javob - 0,1,2,3,4,5,6 break i 7 ga teng bo'lganida to'xtaydi.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay