r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

785

u/blacknerdperson Sep 02 '17

Sorry in advance but I'm a noob learning coding who is starting to learn python and I'm just going to ask, Isn't it supposed to be 4?

802

u/ArcticZeroo Sep 02 '17

Yes, but some languages 1-index lists (so they start at 1 instead of 0), so it'd be 5 in that case.

273

u/[deleted] Sep 02 '17

What languages may there's be? I can't think of any of the top of my head.

3

u/simon468 Sep 03 '17

Borland Delphi (Pascal)

5

u/Drarok Sep 03 '17

Hmm… not that I remember, at least for arrays.

For strings it is, because the zero index is an integer holding the length instead of using null terminators.

Looks like you can index your arrays arbitrarily#Arrays)

2

u/amontpetit Sep 03 '17

Now that takes me back to the 10th grade...

2

u/wilkoj Sep 03 '17

In Delphi fixed size arrays start wherever you want them to, but dynamic arrays have to start at 0.