🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

Python में break और continue का अंतर क्या है?

What is the difference between break and continue in Python?

A
break skips next iteration, continue exits loop
B
break exits loop, continue skips current iteration
C
both do same work
D
both only work in functions
Explanation

Python में break और continue दोनों का उपयोग loops (जैसे for, while) में किया जाता है, लेकिन उनका काम अलग होता है:


break:

  • Loop को पूरी तरह से रोक देता है

  • यानी जहां break मिला, वहीं से loop बंद हो जाता है

 
for i in range(5):
if i == 3:
break
print(i)
# Output: 0 1 2

continue:

  • उस iteration को छोड़ देता है और अगली iteration पर चला जाता है

  • Loop चलता रहता है

 
for i in range(5):
if i == 3:
continue
print(i)
# Output: 0 1 2 4

Correct Answer: B) break exits loop, continue skips current iteration

Latest Updates