Does this if statement work correctly?
in
Programming Questions
•
4 months ago
Just wanna make sure if my function does what I think it does.
I think that if statement at line 4 or 5 is true, loop starts over. And if the loop ends and these statement at line 5 has never been false function returns true. Am I right?:
- boolean myFunction(int exeption){
- for(int i=0; i<whatever.length; i++){
- if(i==exeption){} else
- if (thisstatementistrue) {/*increment i and loop again*/} else {return false;}
- }
- return true;
- }
1