I'm learning lists and adding/removing. In the below code I create a list , generate a random number - and then want to permanently remove the number from the list:
cardsLST.AddAll(Array As Int(1,2,3,4,5)) 'create the list
s = Rnd(1,6) 'generate a random number 1-5
Msgbox(s,"") 'display the randomly generated number
Msgbox(cardsLST,"") 'display the current list members
cardsLST.RemoveAt(s) 'remove the generated value from the list
Msgbox(strtCardsLST,"") 'display the updated list members
I can't make sense of the numbers... for example... If I generate a 1, a 2 is removed from the list. If I generate a 5, I get an out of bounds exception
List and array indeces are zero based so your list is indexed from 0 to 4.