举例来说,我如何在VB中实现这个?
foreach foo in bar
{
if (foo == null)
break;
if (foo = "sample")
continue;
// More code
//...
}
举例来说,我如何在VB中实现这个?
foreach foo in bar
{
if (foo == null)
break;
if (foo = "sample")
continue;
// More code
//...
}
--编辑:
自我回答后,您已更改了问题,但我将保留我的答案。我猜一个VB.NET程序员会告诉你如何实现这样的循环。我不想尝试伤害可怜的C#编译器的感情...
--旧回答:
我认为是有的。
Continue While
Continue For
和
Exit While
Exit For
Sub breakTest()
For i = 0 To 10
If (i = 5) Then
Exit For
End If
Console.WriteLine(i)
Next
For i = 0 To 10
If (i = 5) Then
Continue For
End If
Console.WriteLine(i)
Next
End Sub
break 的输出结果:
0
1
2
3
4
0
1
2
3
4
6
7
8
9
10