Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Off-by-one error
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Logical error that can often be found in programming}} {{Redirect|OBOB|the book trivia competition|Oregon Battle of the Books}} {{Multiple issues| {{confusing|date=May 2022}} {{More citations needed|date=July 2020}} }} An '''off-by-one error''' or '''off-by-one bug''' (known by acronyms '''OBOE''', '''OBO''', '''OB1''' and '''OBOB''') is a [[logic error]] that involves a number that differs from its intended value by 1. An off-by-one error can sometimes appear in a [[mathematics|mathematical]] context. It often occurs in [[computer programming]] when a [[control flow#Loops|loop]] iterates one time too many or too few, usually caused by the use of non-strict inequality (β€) as the terminating condition where strict inequality (<) should have been used, or vice versa. Off-by-one errors also stem from confusion over [[zero-based numbering]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)