I have the following code:
for (int i=0; i<B.size(); i++) {
if (result[i]=false) {
res=false;
break;
}
else {
res=true;}
}
return res;
I want to break the whole loop if res is false and return res as false. But even though res becomes false at some point, in the next iteration of the for loop, it becomes again true and falsely returns true in the end. How can I fix this?
Aucun commentaire:
Enregistrer un commentaire