Why is the 0 key last on the QWERTY keyboard layout and scan codes, but the first in ASCII and EBCDIC?
In ASCII, 0 is first, before 1.
In EBCDIC, 0 is still first, before 1.
This enables computations and conversions between codes and digits, simply by subtracting "0".
Eg: "0" - "0" (ASCII or EBCDIC) = 0 (Digit)
& : "9" - "0" (ASCII or EBCDIC) = 9 (Digit)
Moreover, this is the Natural Universal Sequence.
In the QWERTY Keyboard layout, 0 comes last, after 9.
The Scan codes are similar, with 0 coming last, after 9.
What is the advantage of this layout ?
The first QWERTY layout is depicted in Sholes's 1878 patent:
Many early typewriter keyboards then did not have any key to the left
of the "2", since a typist who needed to type the digit below that could
use an uppercase I
or lowercase l
for the purpose.
Typewriter keyboards which used a shift key for uppercase did generally include a "0". However, since typing an uppercase "O" as an alternative would require using the shift key, putting the zero to the right of the nine meant that it could be in the same place on keyboards which include a "1" as on keys which do not.
Another possible factor influencing the design is a telephone dial. On a rotary telephone in many countries, dialing a "1" will briefly interrupt the line current once; dialing a "2" will briefly interrupt the line current twice. Having "0" interrupt the line current zero times would be impractical, so instead it interrupts the line current ten times. With that technical logic, it's much easier for the dial to be arranged "1234567890".
Sources:
- Wikipedia QWERTY
- Wikipedia Telephone
- Why is the 0 next to 9, not next to 1?