Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    9
    Views
    1,168

    Re: Please help with method return statement!

    When not prime is found, the code should stop looping.
  2. Replies
    9
    Views
    1,168

    Re: Please help with method return statement!

    An example:
    return true;
  3. Replies
    9
    Views
    1,168

    Re: Please help with method return statement!

    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.
  4. Replies
    9
    Views
    1,168

    Re: Please help with method return statement!

    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: ...
Results 1 to 4 of 4