Conditionals
See the source code for this page to see how the components are used.
If and Switch can be tested using the controls below. Enter a number and click the button to set the variable to that number. The display should change depending on the value of the number.
If
Replaces the Razor @if with a component.
Number is 5 or less
Switch
n is not one, two or three
ForEach
Replaces the Razor @foreach statement with a component.
- 0
- 1
- 2
- 0
- 1
- 2