如下c#代码: int sum=0; for(int i=1;i<101;i++) { if(i%2!=0) { continue; } sum+=i; } 可以考虑用以下vb.net代码实现: dim sum as integer, i as integer for i = 1 to 100 if (i mod 2 = 0) then sum = sum + i end if next
dim sum as integer, i as integer for i = 1 to 100 if (i mod 2 <> 0) then goto continue end if sum = sum + i continue: next
另外在vb.net 2005,已经实现了continue语法 for i as integer = 0 to 100 if i = 50 skip console.writeline statement if i = 50 then continue for console.writeline(i.tostring) next
do while using continue statement. dim ii as integer = 1 do while ii < 100 ii += 1 if i = 50 skip console.writeline statement if ii = 50 then continue do console.writeline(ii.tostring) loop
while using continue statement. dim iii as integer = 1 while iii < 100 iii += 1 if i = 50 skip console.writeline statement if iii = 50 then continue while console.writeline(iii.tostring) end while