Results 1 to 3 of 3

Thread: [RESOLVED] Continue Keyword In a Double Nested For Loop

  1. #1

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    [RESOLVED] Continue Keyword In a Double Nested For Loop

    I need to continue an itineration in a double nested loop, but I need the continue statement to progress the OUTER loop even though it is in the INNER loop:

    Here's a very basic example:
    Code:
    for x=0 to 200
        for y=0 to 100
            if y=10 then continue 'I want to continue the next x loop not the y loop
        next
    next
    I thought specifying the loop variable would do the trick (continue x) but I'm getting a syntax error.

    Any way to do this in VB.Net?

    Thanx!
    Last edited by neef; Aug 28th, 2008 at 06:20 PM.
    Intermediate Level Programmer Extraordinaire

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Continue Keyword In a Double Nested For Loop

    will this help ?

    Code:
    for x=0 to 200
        for y=0 to 100
            if y=10 then
                  Exit For       
             End if
        next
    next
    or simply use another function and pass value of x and y to continue with whatever operation you want to perform.
    __________________
    Rate the posts that helped you

  3. #3

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    Re: Continue Keyword In a Double Nested For Loop

    That was helpful; thanks!
    Intermediate Level Programmer Extraordinaire

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width