Just a quick question. I am new to using “break” and I am making a program that checks an integer grid if the number 1 is in an entry. Obviously I don’t want to check the rest of the grid if I have found an entry that is equal to 1. Therefore, I wanted to use “break” but should I use break twice in the inner for-loop to exit the double for-loop?
My overall program is a little more complicated than that but you should get the idea by looking at the code below:
for(int i=0; i< minnumberrow; i++){ // does something for each line in the file
for(int j=0; j< minnumbercol; j++){ // do something for each collum of each line
if(int(lines[i].charAt(j))==49){ // if it is a 0 or a 1 (49 seems to be 1 in char)
taken=true;
break;
}
}
}