Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I'm also curious what the arguments are in your university.
As this is the 0th time I've heard something like this. -
hell169546y@kenogo I guess arrays start with 0 because that is the default value assigned to `int` in most languages. ( I might be wrong ).
Maybe it has to be that the first default memory address is 0x0 and it made sense back then to start arrays by 0 ( and I don't know wtf I'm talking about )
It actually makes sense, to me, to start counting from 0 , everybody learns the sequence of numbers is:
0 , 1, 2 , 3...
Anyway, what confuses people (at least me) about array indexing are functions like:
`getArraySlice(countsFromOne, countsFromZero)`
These kind of function make me wanna scream and murder the dev, and a lot of languages do this shit. -
hell169546y@kenogo yeah, that is the behaviour of most array transformations but wouldn't it be a lot more intuitive if it was:
arr = [8,6,3,5,1]
get_art_slice(arr,1,3)
> [6,3,5]
I was always confused by that.
It is as @SoulSkrix said, the offset, but why can't it be "slice by index, inclusive" ?
Because most of those function mix offset with index. -
epetrov366y@azous are you saying that “nothing COMES from nothing” or are you saying that “NOTHING comes from nothing”? It could be interpreted both ways.
-
hell169546y@epetrov I said that:
"A thing" to exist there must be previous existence that promoted its existence.
But you might argue: but dude, some "day" there has to be a time where there was no things, no atoms, no electromagnetic forces, no "things" and out of nowhere there was the first "thing" and the second "thing" and so on.
Yeah, logically there was a time where "things" came to existence out of no "things" but to maintain sanity:
Nothing comes from nothing. -
I think it should have been implemented starting at 1 from the very beginning, as this is how we count. However, now that it's basically established law, some individual languages starting from 1 are just making the confusion worse.
Related Rants
At University we are currently learning why we should use 1-based Arrays not 0-based.
rant
arrays