GulfOfMexico icon indicating copy to clipboard operation
GulfOfMexico copied to clipboard

array indexing should start from the center

Open eMBee opened this issue 2 years ago • 1 comments

i feel that starting array indexing at -1 is very counterintuitive. instead it should start at the center, 0 is the middle element of the array, negative indexes are before, and positive indexes after the center. arrays with an even number of elements skip the 0.

so a 10-element array is indexed [-5,-4,-3,-2,-1,1,2,3,4,5] and an 11-element array would be [-5,-4,-3,-2,-1,0,1,2,3,4,5]

eMBee avatar Aug 07 '23 02:08 eMBee

Doing arr[0] on a even number array should return randomly between arr[-1] and arr[1] to prevent annoying errors

ktlknss avatar Nov 23 '24 10:11 ktlknss