以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  多个For 嵌套时  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=80114)

--  作者:文道古月
--  发布时间:2016/1/16 14:55:00
--  多个For 嵌套时

请教,多层循环嵌套时,每个for是怎么循环的?

 

比如,for1循环第一次时,for2是也循环一次,还是完成for2的全部循环,for1再开始第二次循环呢?接着for3又跟着怎么循环呢....

 

for   ’1

   for   ’2

      for  ’3

........

         next

    next

next


--  作者:Hyphen
--  发布时间:2016/1/16 15:33:00
--  
执行后看看结果
For i As Integer = 0 To 2
    For i2 As Integer = 10 To 12
        For i3 As Integer = 20 To 22
            Output.Show(i & "-" & i2 & "-" & i3)
        Next
    Next
Next