title: Unreachable code detected in the for loop
body: <p>I'm trying to find out if a number is prime or not. But I've got an error of "unreachable code detected", which I think is effecting the error of "not all code paths return a value". The error seems to occur in the for loop at i++. Can anyone help me please?</p>
  
  <pre><code>static void Main(string[] args)
      {
          Console.WriteLine(isPrime(10));
      }
  
      public static bool isPrime(int n)
      {
          for (int i = 2; i &lt; n; i++)
          {
              if (n % i == 0)
              {
                  return false;
              }
              return true;
          }
      }
  </code></pre>