I have a list with 3 items and the following only ever gives me the last item of the three entered.
The Dim's are all correct and irrelevant.
I naturally assume size-1 to be the last item in the list as is usual
The log shows the size correctly. Log below. Help please?
The list
[C=6, IsInitialized=false, R=7
[C=6, IsInitialized=false, R=8
[C=7, IsInitialized=false, R=8
The loop output
myList size 3
last [C=7, IsInitialized=false, R=8
Size 2
last [C=7, IsInitialized=false, R=8
Size 1
last [C=7, IsInitialized=false, R=8
Size 0
The Dim's are all correct and irrelevant.
I naturally assume size-1 to be the last item in the list as is usual
The log shows the size correctly. Log below. Help please?
B4X:
Do While myList.size > 0
A=myList.Get(myList.size-1)
log("Last " & A)
myList.RemoveAt(myList.size-1)
log("Size " & myList.size)
Loop
The list
[C=6, IsInitialized=false, R=7
[C=6, IsInitialized=false, R=8
[C=7, IsInitialized=false, R=8
The loop output
myList size 3
last [C=7, IsInitialized=false, R=8
Size 2
last [C=7, IsInitialized=false, R=8
Size 1
last [C=7, IsInitialized=false, R=8
Size 0