title: Is it good practice use more that one RETURN statement in a method?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/708675/why-is-it-good-practice-to-return-at-the-end-of-a-method">Why is it good practice to return at the end of a method</a>  </p>
  </blockquote>
  
  
  
  <p>I would like to know if could be considered good practice use several RETURN statements in a method and why.
  If not, I would like to know how you would rewrite the code in a different way.</p>
  
  <pre><code>public string GetNominativeById(int? candidateId)
          {
              if (candidateId.HasValue)
                  return repepositoryCandidate.GetById(candidateId.Value).Nominative;
               else
                  return string.Empty;
              }
          }
  </code></pre>
  
  <p>With one RETURN</p>
  
  <pre><code> public string GetNominativeById(int? candidateId)
      {
          string result;
          if (candidateId.HasValue)
              result =  repepositoryCandidate.GetById(candidateId.Value).Nominative;
           else
              result =  string.Empty;
  
          return result;
          }
      }
  </code></pre>