VB.NET中的for循环

Dim c As Integer = 0
For i As Integer = 0 To 10
    If i = 2 Or i = 3 Then
        c = c + 1
        Continue For
    End If
    c = c + 1
Next

循环11次,0~10,包括0和10

Continue For结束本次循环。相当于java中的(continue)

Exit For 跳出循环。相当于java中的(break)

翻译成java

int c=0;
for(int i=0;i<=10;i++){
    if(i==2||i==3){
        continue;
    }
    c++;
}

你可能感兴趣的:(VB.net)