Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
added 28 characters in body
Source Link
Géry Ogam

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0 (convention 2: −1 < ib; convention 4: −1 < i < b + 1). Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range (convention 2: −1 < ib, where b < 0; convention 3: 0 ≤ ib, where b < 0). Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0 (0 ≤ i < b + 1), and an upper bound of 0, which is a natural number, to denote a range starting at 0 that has shrunk to the empty range (0 ≤ i < 0). So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and an upper bound of 0, which is a natural number, to denote a range starting at 0 that has shrunk to the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0 (convention 2: −1 < ib; convention 4: −1 < i < b + 1). Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range (convention 2: −1 < i ��� b, where b < 0; convention 3: 0 ≤ ib, where b < 0). Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0 (0 ≤ i < b + 1), and an upper bound of 0, which is a natural number, to denote a range starting at 0 that has shrunk to the empty range (0 ≤ i < 0). So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

added 28 characters in body
Source Link
Géry Ogam

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and an upper bound of 0, which is a natural number, to denote a range starting at 0 that has shrunk to the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and an upper bound of 0 to denote a range starting at 0 that has shrunk to the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and an upper bound of 0, which is a natural number, to denote a range starting at 0 that has shrunk to the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

added 40 characters in body
Source Link
Géry Ogam

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and any integeran upper bound less than or equal to the lower boundof 0 to denote a range starting at 0 that has shrunk to the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and any integer upper bound less than or equal to the lower bound to denote the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

Summary of Edsger Dijkstra’s notes Why Numbering Should Start at Zero.

Range convention

There are 4 conventions to denote a range of natural numbers a, a + 1, …, b:

  1. ai < b + 1.
  2. a − 1 < ib.
  3. aib.
  4. a − 1 < i < b + 1.

Excluding the lower bound like in range conventions 2 and 4 gives a lower bound of −1, which is not a natural number, to denote a range starting at 0. Including the upper bound like in range conventions 2 and 3 gives a negative upper bound, which is not a natural number, to denote a range starting at 0 that has shrunk to the empty range. Including the lower bound and excluding the upper bound like in range convention 1 gives a lower bound of 0, which is a natural number, to denote a range starting at 0, and an upper bound of 0 to denote a range starting at 0 that has shrunk to the empty range. So range convention 1 should be preferred.

Index convention

There are 2 conventions to index n elements:

  1. Starting at 0.
  2. Starting at 1.

Starting at 1 like in index convention 2 gives the index range 1 ≤ i < n + 1, following the preferred range convention. Starting at 0 like in index convention 1 gives the index range 0 ≤ i < n, following the preferred range convention, which is nicer. So index convention 1 should be preferred.

[Edit removed during grace period]
Source Link
Géry Ogam
Loading
added 16 characters in body
Source Link
Géry Ogam
Loading
Source Link
Géry Ogam
Loading
lang-py