I want to add a variable outside the foreach and then use that inside the foreach loop
<table class="generalTbl">
    <tr>
        <th>Date</th>
        <th>Location</th>
    </tr>
    @int i;
    @foreach (var item in Model)
    {
      i=0;
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.DueDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.location)
            </td>
        </tr>
    }
</table>
The above example I have added @int i; outside of the foreach and I tried to access it inside the foreach like i=0; But it shows "The name 'i' does not exist in the current context"
How can I access the variable inside the loop?
 
     
     
     
     
     
    