Ant*_*ier 2 vb.net loops for-loop
我正在处理一些代码,并且尝试修改所述循环内循环的结束整数(如标题中所述)
所以看起来像这样
dim x as integer
For i=0 to x
if (some conditions) then
x=x+1
End if
Next
Run Code Online (Sandbox Code Playgroud)
但是,它似乎不起作用,看起来循环使用的是x的静态值而不是动态值。
有没有一种方法可以在不使用an的情况下更新循环的结束整数exit for并重新开始循环?
谢谢
您可以使用While循环。
dim x as integer
Dim i as Integer = 0
While i <= x
if (some conditions) then
x=x+1
End if
End While
Run Code Online (Sandbox Code Playgroud)