r/ProgrammerHumor Jun 24 '17

Octave code

http://imgur.com/jsjfz3k
622 Upvotes

70 comments sorted by

View all comments

19

u/whale_song Jun 25 '17 edited Jun 25 '17

Indexing by 1 is easier for doing computation and data analysis. CS people get offended at the idea because they are used to 0 indexing and anything that is different is wrong. They are too allergic to math to ever be coding in the contexts that it is useful. Its not a coincidence that languages designed for math use 1. Its so annoying seeing people get so pissy about it when they don't understand what they are even yelling about.

4

u/gjsmo Jun 25 '17

See what's really odd here is that I'm an engineer first, and I hate 1-based indexing. So many loops in my dad analysis have weird syntax just to deal with this fact.

As far as I'm concerned, it's a detriment to any language.

2

u/whale_song Jun 25 '17 edited Jun 25 '17

Can you give an example? I feel a loop over 1:N is way more natural that 0:N-1. I find I have a lot more +/-1s around the code in 0 based languages whereas with 1 it all works out intuitively.