What do you think of negative indexes for arrays?
In Perl, this feature does exist. It makes it possible to access the array bidirectionally:
Code: Select all
Dim names.s(5)
; filling the array...
names(0)="Andre"
names(1)="Peter"
names(2)="Tim"
names(3)="Tom"
names(4)="Fred"
; Debugging
Debug names(3) ; Tim
Debug names(5) ; Fred
Debug names(0) ; Andre
Debug names(-1) ; Fred
Debug names(-2) ; Tom
Debug names(-3) ; Tim
; etc...
; Array index out of bound when trying
Debug names(-6)
Debug names(7)
