ASP.NET Razor - VB
执行。
For 循环
个循环。
以使用 for 循环的:
实例
<html>
<body>
@For i=10 To 21
@<p>Line #@i</p>
Next i
</body>
</html>
运行实例
For Each 循环
常要用到 for each 循环。
,for each 任务。for each 成为止。
遍历 ASP.NET Request.ServerVariables 集合。
实例
<html>
<body>
<ul>
@For Each x In Request.ServerVariables
@<li>@x</li>
Next x
</ul>
</body>
</html>
运行实例
While 循环
while 的循环。
while 词 while
while 增减。
,+= 变量 i 增加 1。
实例
<html>
<body>
@Code
Dim i=0
Do While i<5
i += 1
@<p>Line #@i</p>
Loop
End Code
</body>
</html>
运行实例
数组
了:
实例
@Code
Dim members As String()={"Jani","Hege","Kai","Jim"}
i=Array.IndexOf(members,"Kai")+1
len=members.Length
x=members(2-1)
end Code
<html>
<body>
<h3>Members</h3>
@For Each person In members
@<p>@person</p>
Next person
<p>The number of names in Members are @len</p>
<p>The person at position 2 is @x</p>
<p>Kai is now in position @i</p>
</body>
</html>
运行实例