Off-by-one Error
Version 1.0.0 · Updated 2026-07-28
CORE DEFINITION
An off-by-one error (OBOE) is an error in counting where the result is one more or one less than it should be due to a mistake in judging boundary conditions. It typically refers to a programming error in which a loop iterates one time too many or one time too few, and is a type of logical error. For example, a programmer might use "less than" instead of "less than or equal to" in a loop comparison, or fail to account for a sequence starting at 0 rather than 1 (as is the case with array indices in many programming languages). This error also occurs in mathematics.
SCAFFOLDING EFFECT
Reduce cognitive load
An off-by-one error (OBOE) is an error in counting where the result is one more or one less than it should be due to a mistake in judging boundary conditions. It typically refers to a programming error in which a loop iterates one time too many or one time too few, and is a type of logical error. For example, a programmer might use "less than" instead of "less than or equal to" in a loop comparison, or fail to account for a sequence starting at 0 rather than 1 (as is the case with array indices in many programming languages). This error also occurs in mathematics.
Anchor fast decisions
In counting, indexing, and boundary handling, a deviation in the starting/ending point (e.g., counting from 0 vs. 1) leads to a result that is off by one. The root cause is confusion between "interval endpoints" and "counting" (the number of posts equals the number of intervals plus one).
MINIMUM ACTION
In progress 0/4Practice this model in one real situation:
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more
Source support: Explicit
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%B7%AE%E4%B8%80%E9%94%99%E8%AF%AFverified
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS