CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    Minneapolis
    Posts
    98

    [VB] Continue statement on FOR loop

    I can not find anywhere the definition of a continue for a VB FOR loop


    for i = 0 to 10
    if i = 2
    continue

    else
    'do some other stuff
    end if
    next i

    I have tried

  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452
    You don't need anything like that. your loop will continue without any statement there. The following 2 loops will do what you want.

    for i = 0 to 10
    if i = 2
    else
    'do some other stuff
    end if
    next i

    for i = 0 to 10
    if i <> 2
    'do some other stuff
    end if
    next i

  3. #3
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210
    VB does not have contrinue

    this can be an alternative :

    Code:
    For n=1 to 100
    'do some code
    if ... then goto Continue:
    'do some code
    'do some code
    Continue:
    Next

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

Featured