B4J Question for loop step -1 , breakpoint not reacheable

le_toubib

Active Member
Licensed User
hi all


in the following code :
B4X:
    For i =0 To Q_count.Text-1
       
        For ii = 0 To catcount.Text - 1 Step -1
       
            If i > catplaces.Get(catcount.Text-1) Then
           
                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 ?
 

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:
Top