off-by-one error
noun1
Computing, Engineering, Mathematics, Natural sciences, Physical sciences, Programming, Sciences A logic error where a value, typically the number of iterations of a loop, is specified incorrectly, being either 1 less or 1 more than it should be.
- Using an incorrect relational operator or an incorrect final value of a loop counter in the loop-continuation condition of a repetition statement causes an off-by-one error.2005, Harvey M. Deitel, Paul J. Deitel, C# for Programmers, second edition, Prentice Hall Professional, →ISBN, page 164:
- Related terms
- fencepost problem