You have not explained what does not work, but from your code it seems that the value of the variable āiā is not increasing, instead you check the output of ā0 ++;ā.
This is because the purpose of the @ symbol in a razor
- for conclusion
- and therefore it displays the identifier "i", and then continues the remaining text "++;".
In order to achieve what you apparently want to do (just increase the value of i), you must wrap it in a code block as follows:
@{ i++; }
However, if you want to display the value of i before increasing it, you must wrap it in an expression block, as shown below:
@(i++)
source share