title: Razor function: What is the difference between @helper and @functions
body: <p>Few question about razor function in asp.net mvc.</p>
  
  <p>1) see the code below</p>
  
  <pre><code>@helper WelcomeMessage(string username)
  {
      &lt;p&gt;Welcome, @username.&lt;/p&gt;
  }
  </code></pre>
  
  <p>Then you invoke it like this: <code>@WelcomeMessage("John Smith")</code></p>
  
  <pre><code>@functions{
      public string GetSomeString(){
          return string.Empty;
      }
  }
  </code></pre>
  
  <p>see there is two razor function. in one <code>@helper</code> is used to declare razor function and in second one @functions. so tell me what is the difference between <code>@helper and @functions</code> ?</p>
  
  <p>2) can we declare razor function in .cs code...if yes then is there any convention we need to follow ?</p>
  
  <p>3) can we return integer from razor function</p>
  
  <pre><code>@helper Calculator(int a, int b)
  {
      @{
          var sum = a + b;
      }
      &lt;b&gt;@sum&lt;/b&gt;
  }
  
  @Calculator(1, 2)
  </code></pre>
  
  <p>can we return sum to its calling environment?</p>