# P6.6 Python Loops मध्ये break आणि continue

Source: https://ravindrabagale.com/mr/datascience/py06-python-for-loops-and-while-loops-explained-with-examples/p6-6-break-and-continue-in-python-loops.html
Language: mr (Marathi with English technical terms)

हे का शिकायचं?

पहिली चूक सापडली की थांबायचं किंवा रिकाम्या values सोडून पुढे जायचं असतं.

हे काय आहे?

break loop पूर्ण थांबवतो. continue फक्त ही फेरी सोडून पुढच्या item कडे जातो.

कसं करायचं?

Step 1. Condition तपासा.
Step 2. थांबायचं असेल तर break.
Step 3. फक्त skip करायचं असेल तर continue.

उदाहरण A: पहिल्या problem वर थांबा

```python
balances = [500, 230, -40, 900]
for b in balances:
    if b < 0:
        print("First negative:", b)
        break
```

Output:

```text
First negative: -40
```

याचा अर्थ: break नंतर पुढचे items तपासले गेले नाहीत.

उदाहरण B: रिकाम्या values skip करा

```python
temps = [98.6, None, 99.1, None, 100.4]
total = 0
count = 0
for t in temps:
    if t is None:
        continue
    total += t
    count += 1
print(round(total / count, 2))
```

Output:

```text
99.37
```

याचा अर्थ: continue मुळे रिकाम्या values सोडून बाकीचे process झाले.

रवींद्र बागले यांची tip

`break` फक्त सर्वात आतला loop थांबवतो. Loops उथळ ठेवा — वाचनीय code साठी दोन पातळ्या पुरेशा.
