When not prime is found, the code should stop looping.
Type: Posts; User: Norm
When not prime is found, the code should stop looping.
An example:
return true;
No, there can be more than one.
The compiler wants a guaranteed return statement. The posted code can skip the for loop with some values of number. Add a return at the end of the method.
The compiler doesn't go through the logic to see if for loop will execute or not.
It wants a return for the possible case where the for loop doesn't ever execute. What if number is 0?
Bottom line: ...