title: MVC4 Razor shorthand if
body: <pre><code>@{(int)Session["current"] == 1 ? Html.ActionLink("Home", "Index", "Home", new { @class = "selected" }) : Html.ActionLink("Home", "Index", "Home");}
  </code></pre>
  
  <p>When I use this code I get an error: 
      CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement</p>
  
  <p>I don't think the ";" supposed to be at the end, but without it I get an error saying that it's missing. I've tried using the &lt;%= %> syntax but that didn't work too.</p>