© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
bkingb

❔ ✅ break 2 for cycles at the same time

My question is in the code
            for (int i = 0; i < heights.Length; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    if (heights[i] < heights[j])
                    {
                        Console.WriteLine("Van olyan ember, aki alacsonyabb, mint a mögötte állók valamelyike!");
                        break; // I want to break all the 2 for cycles here what do I do?

                    }
                }
            }
            for (int i = 0; i < heights.Length; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    if (heights[i] < heights[j])
                    {
                        Console.WriteLine("Van olyan ember, aki alacsonyabb, mint a mögötte állók valamelyike!");
                        break; // I want to break all the 2 for cycles here what do I do?

                    }
                }
            }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Animating both values at the same time
C#CC# / help
2y ago
✅ Winforms: open two forms at the same time
C#CC# / help
3y ago
❔ Iteration over multiple objects at the same time
C#CC# / help
3y ago