BASIC
From Maze
(Difference between revisions)
(→CHR$ and the Dollar Sign in BASIC (Sidebar)) | |||
| Line 59: | Line 59: | ||
== CHR$ and the Dollar Sign in BASIC (Sidebar) == | == CHR$ and the Dollar Sign in BASIC (Sidebar) == | ||
| − | In designing BASIC, Kemeny and Kurtz needed to distinguish variables that hold numeric values from those that hold strings of text. They chose to have string variables and string functions end with "$," so that a string variable might be named A$ and the function that produced one-character strings based on ASCII values was called CHR$. In their book ''Back to BASIC,'' they explain why they selected the dollar sign: "There were not so many keys on a Teletype, and we needed to find one that had not yet been used for BASIC. Of the few remaining ones, none seemed very appropriate. Then one of us observed that $ looks like S for string." | + | In designing BASIC, Kemeny and Kurtz needed to distinguish variables that hold numeric values from those that hold strings of text. They chose to have string variables and string functions end with "$," so that a string variable might be named A$ and the function that produced one-character strings based on ASCII values was called CHR$. They selected the dollar sign because "There were not so many keys on a Teletype, and we needed to find one that had not yet been used for BASIC. Of the few remaining ones, none seemed very appropriate. Then one of us observed that $ looks like S for string." (BtB p. 28) |
Computers are fundamentally machines to add and multiply; the accounting and commercial functions that they carry out are much higher-level. So it is a curious circumstance that the Commodore 64 keyboard, like modern North American keyboards, has a dollar sign on it but does not have a multiplication sign. Instead, the asterisk (*), a typographical mark used to indicate a footnote, is pressed into service as the symbol for multiplication. | Computers are fundamentally machines to add and multiply; the accounting and commercial functions that they carry out are much higher-level. So it is a curious circumstance that the Commodore 64 keyboard, like modern North American keyboards, has a dollar sign on it but does not have a multiplication sign. Instead, the asterisk (*), a typographical mark used to indicate a footnote, is pressed into service as the symbol for multiplication. | ||
