• 0 Posts
  • 2 Comments
Joined 2 years ago
cake
Cake day: June 9th, 2023

help-circle

  • I think it would depend on the typical user base and how the rest of the cli operates. If it’s typical array work or your users are typically programmers or otherwise know computing, then stick to 0 based indexing. If they’re users of spreadsheets and rarely interface with zero-based indicies, then stick to what they know. Just document it well enough for everyone!

    I’d also think inclusive is more intuitive. If they only want one element, then they can provide the single element, otherwise they get the full range.

    Although, if your cli is trying to mimic another programming function. If it’s very clear that’s the intent, then follow the functionality of the parent function.