• queerlilhayseed@piefed.blahaj.zone
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 hours ago

      Off-by-one errors are real errors. A common mistake rookie developers make (or used to make, anyway) is forgetting that arrays are zero-indexed when creating an array, then seeing the value that should be in array[n-1] when they read array[n].

      Another common off-by-one error is double counting: Some accumulators don’t do all their processing in the same function, and occasionally one thing will be checked for inclusion twice, causing the accumulator to have one more element than it should.