Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找如下的 for 循环
dim i as integer dim j as integer = 5 For i = 0 To j If i = 5 Then i = 10 j = 20 End If Next
''如果 i=5 那么我想将 i 增加到 10 并将 j 增加到 20,这样循环将扩展到 10 到 20
谁能建议我如何做到这一点。
dim i as integer = 1 dim j as integer = 5 while i <= j if i = 5 then i = 10 j = 20 end if end while
我想用一段时间你会发现它更容易理解
不要试图改变你的循环变量。循环总是会达到 5,因此“扩展”到 10。首先让它循环到 10。如果你想在内部使用一个变化的值,那么在适当的时候j创建一个不同的变量k,然后使用它。510k
j
k
5
10