B4J Question for loop step -1 , breakpoint not reacheable

Discussion in 'B4J Questions' started by le_toubib, Apr 8, 2015.

  1. le_toubib

    le_toubib Active Member Licensed User

    hi all


    in the following code :
    Code:
    For i =0 To Q_count.Text-1
           
            
    For ii = 0 To catcount.Text - 1 Step -1
           
                
    If i > catplaces.Get(catcount.Text-1Then
               
                    question(i).catego = cat.Get(catcount.Text-
    1)
                
    End If
                
    If i <= catplaces.Get(ii) Then
               
                    question(i).catego = cat.Get(ii)
                
    End If
            
    Next
        
    Next

    if i put a breackpoint inside any line inside the inner (backwards) loop , e.g
    If i > catplaces.Get(catcount.Text-1) Then
    the breackpoint is never reacheable, and indeed the code is not executed.

    what am i missing here ?
     
  2. Daestrum

    Daestrum Well-Known Member Licensed User

    The step -1 looks suspicious as you start at zero, unless catcount.Text is always negative.

    Possibly you meant catcount.Text - 1 to 0 step -1
     
    Last edited: Apr 8, 2015
  3. le_toubib

    le_toubib Active Member Licensed User

    Aha , you are right , that's what I meant.
    Thanks a million
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice