Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3982126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:29:29+00:00 2026-05-20T05:29:29+00:00

I am having some trouble trying to simplify some logic that is contained in

  • 0

I am having some trouble trying to simplify some logic that is contained in nested loops

I have provided some pseudo code below, that is the basics of what I’m dealing with. The actual code is more complex and contains multiple nested loop structures.

I’m in charge of maintaining this code, I’m not the original writer of it

Would this be a place that a goto is valid.

while(CONDITION)
{
  while(CONDITITION2)
  {
    if(CONDITION3)
      break CONDITION2

    if(CONDITION4)
      break CONDITION
  }
}

There are many complexities to preforming these code breaks.

I am not allowed to use a goto, but I think it would be an easier solution that what I am currently trying to do. Should I try and justify the use of a goto in this case.
thanks

PRASHANT 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:29:30+00:00Added an answer on May 20, 2026 at 5:29 am

    You’re setting yourself up for messy and complicated code. Consider LINQ if possible (loops themselves are practically a code smell these days, especially complicated ones), otherwise consider refactoring the inner loop into a separate method and using return;.

    Edit: great post by Eric Lippert critiquing the various alternatives for this problem: http://blogs.msdn.com/b/ericlippert/archive/2010/01/11/continuing-to-an-outer-loop.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some code in python and I'm having trouble when trying to retrieve
Having some trouble with some nested resources routing. What I'm trying to do is
Hey having some trouble trying to maintain transparency on a png when i create
I'm having some trouble installing and configuring qt on my vista laptop. I'm trying
I am having some trouble with the Google Maps API . I have an
I am having some trouble trying to get a report to print from a
I'm having some CSS trouble when trying to get IE's display the same as
I'm having some trouble with Regex I'm trying to take a money amount like
I'm trying to understand OOP and having some trouble with a couple of concepts
I'm having some trouble with this. I am reading in some text and trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.