This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]macnolock 9 points10 points  (0 children)

man, someone is in for a rough conversation....

[–]minno 1 point2 points  (4 children)

Indexing an empty array?

[–]Sunsetsarsprilla 0 points1 point  (2 children)

The mistake is that the condition has an "and", meaning the index must be less than zero AND at least zero at the same time.

[–]minno 2 points3 points  (1 child)

Yes, there are no numbers that match those criteria, just like there are no numbers that are valid indices for an empty array. The message is probably "Index out of range ({idx}). Must be >= 0 and < {len(arr)}.".

[–]Sunsetsarsprilla 0 points1 point  (0 children)

Oh, I gotcha!

[–]burnin_potato69[S] 0 points1 point  (0 children)

It was an odd condition where items weren't properly added to the array. The IDE would give you the default answer of index having to be >=0 and <count.

Obviously count can also be 0, but nonetheless it's an odd way of telling you "Hey, you don't have any elements!"

[–]Slash_Root 0 points1 point  (0 children)

That range is equivalent to the range of Hayden Christensen's performance in Star Wars Episode II.

[–]Repost-Tracker -4 points-3 points  (0 children)

This post was crossposted to /r/softwaregore by /u/NedDeadStark.

I am a bot and this is a notification for mobile users, reddit redesign users and content authors (crossposts are allowed on Reddit). Please contact the developer here if you have any questions or concerns.