Breaking/exit nested for in vb.net

后端 未结 6 1568
栀梦
栀梦 2020-11-29 00:15

How do I get out of nested for or loop in vb.net?

I tried using exit for but it jumped or breaked only one for loop only.

How can I make it for the following

6条回答
  •  天命终不由人
    2020-11-29 00:24

    If I want to exit a for-to loop, I just set the index beyond the limit:

        For i = 1 To max
            some code
            if this(i) = 25 Then i = max + 1
            some more code...
        Next`
    

    Poppa.

提交回复
热议问题