Attempted to access index 50 from array with length 50!

So i found the solution with trial and error. Turns out i need to subtract 1 from the index to make it 0-49 instead of 0-50!