BASIC

From Maze

(Difference between revisions)
Jump to: navigation, search
(→Works Cited)
(Added sidebar on $)
Line 42:Line 42:
So, while home computing provides a significant context for the program at the center of our discussion, the computer had become more welcoming and available for a wider variety of uses -- even before it moved into the home -- thanks in part to BASIC.
So, while home computing provides a significant context for the program at the center of our discussion, the computer had become more welcoming and available for a wider variety of uses -- even before it moved into the home -- thanks in part to BASIC.
 +
 +
== 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."
 +
 +
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.
 +
 +
Kemeny and Kurtz point to part of the rationale for this. Computers began using Teletypes as interfaces very early on, but the Teletype predated the computer and was used as a means of textual communication from early in the 20th century. The remote typewriter used to transmit commercial information, such as dollar amounts, much more often than it was used for sending mathematical equations.
 +
 +
Of course, the origin of the Teletype in the United States is another important reason that the dollar sign was on Typetypes and was later used in computing and in BASIC. The original, North American Commodore 64 keyboard also sported a pound sterling sign (£), a sure indicator that Commodore planned to sell the computer in the United Kingdom.
 +
 +
The dollar sign is still used in some of today's workhorse programming languages, such as Perl and PHP. In both of these, it is used to indicate a variable by being placed at the beginning, rather than the end, of the variable name. In Perl it specifically indicates a ''scalar'' variable, since $ looks like S for scalar.
== Altair BASIC and Micro-Soft ==
== Altair BASIC and Micro-Soft ==

Revision as of 12:01, 10 July 2011

View this revision of BASIC.

Personal tools