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
Dartmouth BASIC
(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!
===Fifth Edition=== The Fifth Edition, from late 1970, once again started as two supplements to the Fourth Edition, from February and April 1969.{{sfn|Kurtz|1981|p=529}} The major change was the introduction of file handling. Previously, any pre-defined data that had to be used in the program had to be placed in the {{mono|DATA}} lines and then read in one-at-a-time using the {{mono|READ}} command. This feature could be used to read files in a similar fashion. The {{mono|INPUT}} command could now read a single item from a file and {{mono|PRINT}} could write one. {{sfn|Kemeny|Kurtz|1985|p=31}} Files were opened through the new {{code|FILES}} keyword, which was followed by a list of string constants describing file names. As these were constants, changing the file name demanded the code be changed to match. The names were assigned numbers, the first name became file #1, and so on. Two file formats were supported, random-access and linear. A linear file was treated as a text file would be today, one could {{code|LINPUT #1: A$}} to read a line of text into a string variable, and then {{code|PRINT A$}} to output it to the terminal.{{sfn|Kemeny|Kurtz|1985|p=31}} Later versions added the {{code|FILE $1,name$}} to allow files to be specified by strings, although for a time this required a {{code|FILES *}} near the top of the program to indicate you were using this format.{{sfn|Kemeny|Kurtz|1985|p=32}} For random access files, the name had to specify the type of data within; {{code|%}} indicated it contained binary data, while {{code|$num}} indicated it should be read as strings with a maximum length of {{code|num}}.{{sfn|Kemeny|Kurtz|1985|p=31}} The {{mono|READ}} and {{mono|WRITE}} could be positioned anywhere in a random-access file with the {{mono|RESET}} command, while the current location was returned by the {{mono|LOC}} function, and the file length by {{mono|LOF}}. During sequential reads, one could also test whether it was at the end of the file using <code>IF END THEN...</code>.{{sfn|Kurtz|1981|p=530}} Another major change was the ability for one BASIC program to call another using the {{mono|CHAIN}} command, and pass variables to it using the {{mono|COMMON}} list. It was later realized that this basic concept had a number of problems, but it was nevertheless used to write some large programs.{{sfn|Kurtz|1981|p=530}} String handling received a major update. The new {{code|SEG$}} command returned a new string clipped out of another. In the example above, the string "is" is extracted from a larger string. Using the new command, this can be reduced to {{code|LET T$ {{=}} SEG$(S$,5,6)|basic}}, which works similarly to the {{code|MID$}} function found in most dialects ({{code|MID$(S$,5,2)}}). SEG$ uses first and last indices; MID$ uses first index and length. {{code|LEN}} returned the length of a string, which was otherwise now handled internally and did not require calculation in most cases, and {{code|POS}} returned the position of one string within another, which in most dialects was handled by {{code|SUBSTR}}. The ampersand, {{code|&}}, was introduced for [[Concatenation|string concatenation]].{{sfn|Kemeny|Kurtz|1985|p=29}} Numerous more minor changes were also added. Among these were two-dimensional string arrays, as opposed to one-dimensional in the previous version, as well as the ability to use the {{mono|DEF}} to define string-based functions as well as mathematical. New system-oriented functions included {{mono|CLK$}}, {{mono|DAT$}} to work with times and dates, {{mono|TIM}} which returned the elapsed time, and {{mono|USR$}} which returned the user number, what would today be the username. New string functions included {{mono|STR$}}, {{mono|VAL}}, {{mono|ASC}}, which are common in modern BASIC dialects. The {{key|'}} as a short form for {{mono|REM}} also appeared in this version.{{sfn|Kurtz|1981|p=530}}
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)