There are two rules for semicolons:
Inside a code block, each complete code statement must end with a semicolon.
<!-- Single-statement block --> @{ var theMonth = DateTime.Now.Month; } <!-- Multi-statement block --> @{ var outsideTemp = 79; var weatherMessage = "Hello, it is " + outsideTemp + " degrees."; }
Inline expressions don't end with a semicolon.
<!-- Inline expression, so no semicolon --> <p>Today's weather: @weatherMessage</p>