break and continue in c++

 #include<iostream>


using namespace std;

int main() {
    for (int i=0 ; i<5 ; i++ )
    {
        // if (i==2){
        //     break;
        // }

        if (i==2){
            continue; //iska mtlb hai jese hi i ki value 2 hui usne kaha iss iteration(repetation)
                      //ko rok do and next iteration pe jao mtlb neeche ab jo bi likha hai
                      //use rok ke continue kro agli iteration pe
                      //continue ke baad vala execute nahi hoga
        }

        cout<<i<<endl;

        // if (i==2){
        //     break; break mtlb vaha se tod ke nikal jao
        // }
    }

    return 0;
}

Comments

Popular posts from this blog

Function Overloading in C++

oops recall, basic operations and nesting of member functions

OBJECT ORIENTED PROGRAMMING, classes public and private access modifiers (syntax)