Normaly I try to avoid sarcastic comments on other, but not this time.
1. I know that using FirstElement() would be faster,
I programmed a linked list library myself which has 1500+ lines of PB code,
and if you read some of my posts, you should now that I know what im programming (most of the time anyway)
So no need to point out this, as if I use PB for about a day.
2. Would you please RTFM about DeleteElement()
The flag says to go to the element that follow the deleted element.
So doing a DeleteElement() and than do NextElement()
must skip an element!
3. Where's there a bugs in my program?????
[Edit]
New code to proof that this is a bug:
Code: Select all
#ListSize = 20
OpenConsole()
NewList l1.l()
For n = 1 To #ListSize
AddElement(l1())
l1() = n
Next n
ResetList(l1())
PrintN("Before deletetion")
n = 0
While NextElement(l1())
PrintN(RSet(Str(n), 3) + ": " + Str(l1()))
n + 1
Wend
PrintN("")
SelectElement(l1(), 0)
For n = 1 To #ListSize >> 1
PrintN("Deleting element " + Str(ListIndex(l1())) + ": " + Str(l1()))
DeleteElement(l1(), 1) ; Delete current element, make next element current element
PrintN("Actual element " + Str(ListIndex(l1())) + ": " + Str(l1()))
NextElement(l1()) ; Should skip one element (but it doesn't)
PrintN("Next element " + Str(ListIndex(l1())) + ": " + Str(l1()))
; NextElement(l1())
Next n
PrintN("")
ResetList(l1())
PrintN("After deletetion: " + Str(ListSize(l1())))
n = 0
While NextElement(l1())
PrintN(RSet(Str(n), 3) + ": " + Str(l1()))
n + 1
Wend
PrintN("")
PrintN("Press ENTER key"): Input()
Have a look at the index and values that should be deleted and what really gets deleted!