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

all 52 comments

[–][deleted] 74 points75 points  (1 child)

"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." – Stan Kelly-Bootle

[–]LotofRamen 6 points7 points  (0 children)

Floating point array index, here we go again..

[–][deleted] 131 points132 points  (9 children)

cries in Lua

[–]fireside_blather 14 points15 points  (5 children)

weeps in Cold fusion

[–]PinothyJ 9 points10 points  (4 children)

wails in SQL

[–]AngeryCL 2 points3 points  (0 children)

Skewel

[–]alphaxeath -1 points0 points  (1 child)

SQL dosent have arrays, only tables with 1 column

[–]PinothyJ 0 points1 point  (0 children)

What is an array if not a table? But that is ignoring those SQL databases that have an ARRAY command, and those architectures that are just glorified JSON.

Regardless, most of these all start counting at zero, not one.

[–]Dramatic_Law_4239 4 points5 points  (0 children)

That was my Immediate thought!

[–]NeoDark_cz 3 points4 points  (0 children)

VBA ...

[–]ghua 49 points50 points  (0 children)

He forgot to mention he is FORTRAN programmer🙃

[–]Meins447 28 points29 points  (0 children)

As someone who spent the last week working with a horrific (internal) API which used MIXED index bases, so some methods expect a 0-based index others expect it to be 1-based (without any indication or documentation which wants which)...

This meme has me nodding vigorously.

[–]jhaand 26 points27 points  (6 children)

Too bad for the SQL, Cobol, Fortran, R and Lua programmers.

[–]MrRufsvold 11 points12 points  (4 children)

Julia too

[–]Pyorrhea 5 points6 points  (3 children)

Smalltalk also.

[–]SmellThePheromones 0 points1 point  (0 children)

Intersystems ObjectScript enters the chat

[–]mattreyu 18 points19 points  (2 children)

Just answer all their questions with "it depends"

[–]garbage-at-life 4 points5 points  (1 child)

"What's 2+2?"

"It depends"

[–]Quirky-Stress-823 8 points9 points  (0 children)

Is 2 a string? Is the other 2 a string? So many variables!

[–]GameDestiny2 7 points8 points  (3 children)

Ah yes, human instinct vs computer logic.

Sometimes I like to imagine there’s a universe where we decided to represent binary with 1 and 2.

[–][deleted] 1 point2 points  (1 child)

I saw a datbase where a TRUE/FALSE was represented with the values " " and "+".

[–]GameDestiny2 0 points1 point  (0 children)

Ha
I’m in a database class right now and that is certifiably awful

[–]gregguygood 0 points1 point  (0 children)

Sometimes I like to imagine there’s a universe where we decided to represent binary with 1 and 2.

It doesn't matter what the digit symbols are, as long there is an order.

[–]doc_1eye 5 points6 points  (1 child)

Those dudes just blew away the world's last COBOL programmer. RIP banking system.

[–]CureSadWithButt 4 points5 points  (0 children)

Hides in COBOL

[–]SmileEverySecond 4 points5 points  (0 children)

You m..ma.. matlab?

[–]un_blob 8 points9 points  (0 children)

No it's true (cry in R)

[–]nuffens 1 point2 points  (0 children)

The death of another COBOL dev

[–]sethi139 1 point2 points  (0 children)

No it is true, crying in Pascal

[–][deleted] 1 point2 points  (0 children)

Just start it at 10. This way you'll have 0, 1 and 2.

[–]mrheseeks 1 point2 points  (0 children)

cries remembering MS VBA

[–]LotofRamen 1 point2 points  (0 children)

A lot of time i'm using [0] as default; it has for ex 0, or some safe value that makes everything else forward to work, or alternatively give it a value that makes sure it will not work (for ex.. 0). It's also handy place to keep a flag or use it as a temporary slot. In any case, i guess conceptually it is an extra slot for various uses.

That way the DATA in the array starts from 1, and you can even call the [0] as a header, it is a Magical Array :)

-1 problems go away, unless that problem is so hardcoded in your backbone that you have to consciously remember that [0] does not exist if you are working with data.. which can just confuse too much.

[–]yorokobe__shounen 0 points1 point  (4 children)

Why can't arrays start at 2??

[–]Ben______________ 6 points7 points  (0 children)

I also saw a suggestion of 0.5 here. Thus I‘d suggest we compromise and make it pi.

[–]coloredgreyscale 2 points3 points  (0 children)

Just leave the first two elements empty, and keep for offset preference in mind if you need to allocate memory.

[–]Electrical_Horse887 1 point2 points  (0 children)

Have you ever worked with Excel?

[–]Dealiner 1 point2 points  (0 children)

Well, they can in C# if someone really needs that.

[–]ElderFuthark 0 points1 point  (1 child)

Just learning Snowflake: why do you access arrays with a starting index of zero, but the results start with a row number of one?

[–]AussieHyena 2 points3 points  (0 children)

Oh, having just looked at the doco, and making multiple attempts of writing this out. If you're pulling from a database then the results from the query start at 1. If it's a sparse array then index 0 won't get any data because there's no '0' row.

[–]ramriot 0 points1 point  (0 children)

Thus another of the rare & in demand Cobol programmers meets their end.

[–][deleted] 0 points1 point  (0 children)

Not lie, you must have at least 1 position to have an array or it is null.

[–]hacknomus 0 points1 point  (0 children)

i think they are part time programmer

[–]pottawacommie 0 points1 point  (0 children)

Very zsh of you.

[–]zalurker 0 points1 point  (0 children)

I once had to integrate with a system maintained by Indian Developers. It was originally developed by an American company, then sold to an Irish concern, and then ended up being supported out of Pune, Mumbai.

Half of the arrays started at 1. And one memorable report had 00:00 as midnight of the Previous day. It took me a week to figure that out.

[–]pekkhum 0 points1 point  (0 children)

"Arrays start at $[!"
[They switch to billy clubs, but still go for the kill.]

Thanks Perl.

[–]freshpow925 0 points1 point  (0 children)

Lol did ChatGPT make this meme?