Results 1 to 3 of 3

Thread: Variable not getting a value

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2007

    Variable not getting a value

    *Sorry if my first post didn't follow the forum rules, while waiting for answers i read the faq's, forum rules and realized what I did.

    Now to my question, I have 2 loops where the counters are set to similar variable(e.g ctr=var1, ctr2=var1) but the inner loops doesn't seem to get the value I want it to get. Here is the code of the 2 loops:
    For ctr = root To 0 Step -1
        For ctr2 = root To 0 Step -1
                lchild = (2 * ctr2) + 1
                rchild = (2 * ctr2) + 2
                If lchild <= upbound And rchild <= upbound Then
                    If arr(rchild) >= arr(lchild) Then
                        mchild = rchild
                        mchild = lchild
                    End If
                    If rchild > upbound Then
                        mchild = lchild
                        mchild = rchild
                    End If
                End If
                If arr(ctr2) < arr(mchild) Then
                    temp = arr(ctr2)
                    arr(ctr2) = arr(mchild)
                    arr(mchild) = temp
                End If
        Next ctr2
    Next ctr
    Thanks in advance.

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    In a probability cloud

    Re: Variable not getting a value

    Quote Originally Posted by znerol
    ...but the inner loops doesn't seem to get the value I want it to get...
    What did you get and what were you expecting? Could you be a bit more explicit?
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  3. #3
    Frenzied Member
    Join Date
    Oct 2003

    Re: Variable not getting a value

    What is the value of root?
    Make the first line of the inner loop a breakpoint. What values do ctr and ctr2 get?

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