Results 1 to 4 of 4

Thread: Nested loop question

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    7

    Question

    Hi,

    I'm a newbie (you can tell by my questions), I'm building a project with a nested loop, I keep getting a compile error saying loop with out do, but the do is there and both loops work outside of each other just not together, any idea's?.
    Thanks!!

  2. #2
    Addicted Member Michael Woolsey's Avatar
    Join Date
    Nov 2000
    Location
    Calgary, Alberta, Canada.
    Posts
    243
    It might be easier if you show us the code you are using... though it sounds like you aren't terminating one of the loops properly.

    Here is an example from the Visual Basic Help file (Under 'Do'):

    Code:
    Dim Check, Counter
    Check = True: Counter = 0   ' Initialize variables.
    Do   ' Outer loop.
       Do While Counter < 20   ' Inner loop.
          Counter = Counter + 1   ' Increment Counter.
          If Counter = 10 Then   ' If condition is True.
             Check = False   ' Set value of flag to False.
             Exit Do   ' Exit inner loop.
          End If
       Loop
    Loop Until Check = False   ' Exit outer loop immediately.
    Hope this helps.
    Michael
    Application/Web Developer

    Visual Basic 6.0 SP5
    Active Server Pages
    Oracle 9i
    - I'm going to live forever, or die trying!

  3. #3
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306
    Check all the structures you´re using. I can bet that the problem is an If without end if. Check all the if, for, do, select case... every structure.

    Send us the code...
    If things were easy, users might be programmers.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Indenting your code is usually the best solution! You'll see the missing end X immediately!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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