bkingb
bkingb
CC#
Created by bkingb on 2/16/2023 in #help
❔ ✅ 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?

}
}
}
8 replies