Razor uses a syntax very similar to PHP and Classic ASP.

Razor:

<ul>
@for (int i = 0; i < 10; i++) {
<li>@i</li>
}
</ul>

PHP:
<ul>
<?php
for ($i = 0; $i < 10; $i++) {
echo("<li>$i</li>");
}
?>
</ul>
 

Classic ASP:

<ul>
<%for i = 0 to 10%>
<li><%=i%></li>
<%next%>
</ul> 

 



Practice Excercise Practice now