title: How to make my methods work properly in this specific case?
body: <pre><code>static void Main(string[] args)
  {
      int nb1, nb2, AddEvens;
      Console.WriteLine("Que vaut le premier chiffre: ");
      nb1 = Convert.ToInt32(Console.ReadLine());
      Console.WriteLine("Que vaut le deuxième chiffre: ");
      nb2 = Convert.ToInt32(Console.ReadLine());
      AddEvens = Add(nb1, nb2);
      Console.WriteLine(AddEvens);
  }
  
  static int Add(int nb1, int nb2)
  {
      for (int i = nb1; i &lt; nb2; nb1++)
      {
          int sum = 0;
          if (nb1 % 2 == 0)
          {
              sum = sum + i;
              return sum;
          }
          return i;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>I am trying to create a program that can sum up even numbers when they are detected. The first two <code>Console.Readline</code> s ask the user for the range in which it will add up the numbers together.</p>
  
  <hr>
  
  <p>Here are my errors: </p>
  
  <blockquote>
    <p>'Program.Add(int, int)': not all code paths return a value</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>Unreachable code detected</p>
  </blockquote>
  
  <p>The first one is at the start of the method creation the other is the <code>nb1++</code> in the <code>for</code> loop.</p>