loops: break continue


Expected result...
/*
1
2
3
4
6
7
8
9
10
*/

In C++
#include 
using namespace std;

int main() {
    int count = 0;
    while (true) {
        count += 1;
        //end loop if count is greater than 10
        if (count > 10) {
            break;
        }
        //skip 5
        if (count == 5) {
            continue;
        }
        cout << count << endl;
    }
}
In golang...
package main
import (
    "fmt"
    "time"
)

func main() {
    test := 0
    for {
        test += 1
        if test > 10 {
            break
        }
        if test == 5 {
            continue
        }

        fmt.Println(test)
        time.Sleep(300 * time.Millisecond)
    }
}

7 comments:

  1. Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.

    AWS Online Training | Online AWS Certification Course - Gangboard
    AWS Training in Chennai | AWS Training Institute in Chennai Velachery, Tambaram, OMR
    AWS Training in Bangalore |Best AWS Training Institute in BTM ,Marathahalli

    ReplyDelete
  2. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.

    angularjs Training in chennai
    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    ReplyDelete
  3. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    python training in pune | python training institute in chennai | python training in Bangalore

    ReplyDelete
  4. Really you have done great job,There are may person searching about that now they will find enough resources by your post
    advanced excel training in bangalore

    ReplyDelete
  5. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    blueprism training in chennai | blueprism training in bangalore | blueprism training in pune | blueprism online training

    ReplyDelete