Off-By-One Error
noun
say it: “AWF by WUN AIR-er” /ɔːf baɪ wʌn ˈɛrɚ/
A bug where a count, a position or a loop is one too many or one too few.
What is an off-by-one error?
An off-by-one error is a bug where a count, a position or a loop is one too many or one too few: stopping a loop one item early, or reading one past the end of a list. It hides at the edges, so the cure is to test the edge cases: the first item, the last item, an empty list and a missing item.
In a sentence
- “Starting high at the list's length instead of the length minus one was an off-by-one error that crashed on the last song.”
Level: Apprentice · More Software Development terms at this level
Updated