๐ฌ Intro – Prem aur Programming dono me Rukawat Aati Hai!
Sochi bhaiya, Guddu apni GF Sweety ke sath date pe jaa rahe the. Achanak Sweety ka mood kharab ho gaya aur boli:
"Bas! Aaj ka date yahin khatam!" ๐ก
Guddu samajh gaya – break ka time aa gaya!
Dusre din, Sweety phir se gussa ho gayi aur boli:
"Abhi baat mat karo!" ๐ค
Guddu samajh gaya – continue karke agla din try karega!
๐ง Break Statement – Jab Loop me Prem ka The End Ho!
Break statement loop ko turant terminate kar deta hai, jaise GF ka "Bas! Ab aur nahi!" kehna.
#include<iostream>
using namespace std;
int main() {
for(int i = 1; i <= 5; i++) {
if(i == 3) {
cout << "GF gussa ho gayi, date cancel!" << endl;
break;
}
cout << "Date number: " << i << endl;
}
return 0;
}
Output:
Date number: 1 Date number: 2 GF gussa ho gayi, date cancel!
๐ Continue Statement – Jab Prem me Thoda Ignore ho, par Koshish Jaari Rahe!
Continue statement current iteration ko skip karta hai, jaise GF ka "Abhi baat mat karo!" kehna.
#include<iostream>
using namespace std;
int main() {
for(int i = 1; i <= 5; i++) {
if(i == 3) {
cout << "GF gussa hai, aaj baat nahi!" << endl;
continue;
}
cout << "Date number: " << i << endl;
}
return 0;
}
Output:
Date number: 1 Date number: 2 GF gussa hai, aaj baat nahi! Date number: 4 Date number: 5
๐ Table Summary:
| Statement | Kaam | GF Analogy |
|---|---|---|
| break | Loop ko turant terminate karta hai | "Bas! Ab aur nahi!" |
| continue | Current iteration skip karta hai | "Abhi baat mat karo!" |
❓ FAQ Section:
Q: Break aur continue me kya farak hai?
๐ Break loop ko turant terminate karta hai, jabki continue current iteration ko skip karta hai.
Q: Kya break aur continue nested loops me use ho sakte hain?
๐ Haan, break aur continue nested loops me bhi use ho sakte hain.
Q: Kya break aur continue performance improve karte hain?
๐ Haan, unnecessary iteration se bachake performance better banate hain.
๐งพ Conclusion:
C++ me break aur continue statement bhi love life ke jaisa hi hai – kabhi complete rukawat, kabhi thoda ignore! Guddu aur Sweety ke coding waale prem kahani se seekh milta ki programming me bhi emotion chhupa hota!
๐ Internal Links:
- C++ If-Else – Jab Dil kahe Haan, Dimaag kahe Na!
- C++ me Loop – Jab Ek Baar I Love You Bolna Kaafi Na Rahe!
- C++ Switch Case – Jab GF bole: Mood ke hisaab se jawab mile!
๐ Next Topic Teaser:
C++ Functions – Jab Har Kaam ke Liye Ek Alag Banda Ho!
Jaise har kaam ke liye alag dost hota hai, waise hi programming me har kaam ke liye ek function hota hai!

No comments:
Post a Comment