Hacker News new | ask | show | jobs
by jasode 3776 days ago
>, beyond languages, data is often 1-based indexed.

That's a good point. Probably the most widespread data example for non-programmers is spreadsheets (MS Excel, Google Sheets). The first row[1] in the spreadsheet is labeled as "1" instead of "0". The idiomatic Visual Basic programming code to loop through the rows would look something like:

  For Each cell In Range("a1:a25")  ' not "a0:a24"
      ' do work
  Next cell
[1]https://www.google.com/search?q=microsoft+excel+spreadsheet+...