Off-by-one error
Meaning in software engineering, with examples
In software engineering, off-by-one error means: A common bug where a loop or calculation goes one step too far or stops one step too early, often because counting starts at zero.
In Turkish: bir eksik/bir fazla hatası, sınır hatası
How it is used
Typical causes are using <= instead of <, or forgetting that the last index is the length minus one. A well-known joke says there are two hard problems in computer science: naming things, cache invalidation and off-by-one errors.
Example sentences
The report missed the last day of the month because of an off-by-one error in the date range.
Check the loop condition; it looks like a classic off-by-one error.
Common collocations
- classic off-by-one error
- off-by-one bug
- fix an off-by-one error
- fencepost error
Related terms
More terms: Debugging and Troubleshooting
Practise with graded reading
Reading at the right level is the fastest way to make new words stick. Pick free English books by level:
