I have three if-else statements. Something like this:
int Group1 = 1;
int Group2 = 3;
int Group3 = 6;
if (Group1 < Group2 && Group1 < Group3)
{
Group1 += 5;
} else
if (Group2 < Group1 && Group2 < Group3)
{
Group2 += 5;
} else
{
Group3 += 5;
}
Now, I believe the code above will go through the first if statement as the Group1 is the smallest, but then the value changes so second if will be processed as well. How to stop on the first if statement and break from the loop when the smallest Group integer is found? or maybe I'm wrong and only first if statement will be calculated?
Aucun commentaire:
Enregistrer un commentaire