title: C# 'if' key word inside <script> tag in razor view
body: <p>I'm trying to write the following code inside ASP.Net-MVC razor view but the page won't compile.</p>
  
  <pre><code>&lt;script&gt;     
  
      @(if (Model.IsValid))
       {
          ("#ErrorMessage).text("Error");
       }
      else
      {
         ("#Registration).text("Done!");
      }
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>There are workarounds that I did to achieve that operation, but is there a simple way?</p>