@inherits Custom.Hybrid.Razor14
<!-- unimportant stuff, hidden -->
@{
var pets = new string[] { "dog", "cat", "mouse"};
var owners = new string[] { "Daniel", "John", "Markus"};
}
Loops - for and foreach @Html.Partial(... <!-- unimportant stuff, hidden -->
<ul>
@foreach(var pet in pets) {
<li>@pet</li>
}
</ul>
Basic for
<ul>
@for(var i = 0; i < pets.Length; i++) {
<li>@pets[i]</li>
}
</ul>
Using a for index with two lists... <!-- unimportant stuff, hidden -->
<ul>
@for(var i = 0; i < pets.Length; i++) {
<li>@pets[i] - owned by @owners[i]</li>
}
</ul>
<!-- unimportant stuff, hidden -->