I have a pretty basic (I think) question. If I have a set of nested loops and/or conditionals, for example like this:
What command can I replace "STOP THE LOOP!!!" with that will break out of the two if statements and the for loop? (I don't want the for-loop to continue no matter how many "potentialHexes" may be left to still iterate through.)
Thanks,
Greg
Code:
for (Hex *h in potentialNextHexes) {
hexIntersect = [self hex:h IntersectsLineFrom:hOrigin to:hTarget];
if ([self distanceBetweenHex:h andHex:hTarget] <= distance && hexIntersect > HEX_WAS_MISSED) {
if (hexIntersect == HEX_WAS_CROSSED) {
*next1 = h;
STOP THE LOOP!!!
}
if (*next1 == nil) *next1 = h;
else *next2 = h;
}
}
What command can I replace "STOP THE LOOP!!!" with that will break out of the two if statements and the for loop? (I don't want the for-loop to continue no matter how many "potentialHexes" may be left to still iterate through.)
Thanks,
Greg