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
Line number
(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!
=== BASIC === Introduced in 1964, [[Dartmouth BASIC]] adopted mandatory line numbers, as in JOSS, but made them integers, as in FORTRAN. As defined initially, BASIC only used line numbers for {{code|GOTO}} and {{code|GOSUB}} (go to subroutine, then return). Some [[Tiny BASIC]] implementations supported numeric expressions instead of constants, while [[switch statement]]s were present in different dialects ({{code|ON}} {{code|GOTO}}; {{code|ON}} {{code|GOSUB}}; {{code|ON ERROR GOTO}}). Line numbers were rarely used elsewhere. One exception was allowing the pointer used by {{code|READ}} (which iterated through {{code|DATA}} statements) to be set to a specific line number using {{code|RESTORE}}. <syntaxhighlight lang="bbcbasic"> 1 REM RESTORE COULD BE USED IF A BASIC LACKED STRING ARRAYS 2 DIM M$(9): REM DEFINE LENGTH OF 9 CHARACTERS 5 INPUT "MONTH #?"; M: IF M<1 OR M>12 THEN 5 7 RESTORE 10*M: READ M$: PRINT M$ 10 DATA "JANUARY" 20 DATA "FEBRUARY" 30 DATA "MARCH" ... </syntaxhighlight> In the first editions of Dartmouth BASIC, {{code|THEN}} could only be followed by a line number (for an ''implied GOTO''), not - as in later implementations - by a statement. The range of valid line numbers varied widely from implementation to implementation, depending on the representation used to store the binary equivalent of the line number (one or two bytes; signed or unsigned). While Dartmouth BASIC supported 1 to 99999, the typical microcomputer implementation supported 1 to 32767 (a signed 16-bit word). {| class="wikitable" |+ Valid Line Numbers in [[Tiny BASIC#Dialects compared|Early BASIC Implementations]] |- ! Range !! Dialect |- | 1 to 254 || MINOL |- | 1 to 255 || Tiny BASIC Design Note |- | 2 to 255 || Denver Tiny BASIC |- | 0 to 999 || UIUC BASIC |- | 1 to 2045 || [[BASIC-PLUS|DEC BASIC-8]] |- | 0 to 32767 || LLL BASIC, NIBL |- | 1 to 32767 || [[Integer BASIC|Apple I BASIC]], [[Level I BASIC]], [[Palo Alto Tiny BASIC]] |- | 0 to 65529 || [[GW-BASIC]], [[IBM BASIC]] |- | 1 to 65535 || [[Altair BASIC|Altair 4K BASIC]], MICRO BASIC 1.3, 6800 Tiny BASIC, Tiny BASIC Extended |- | 1 to 99999 || [[Dartmouth BASIC]] |- | 1 to 999999 || [[SCELBAL]] |- | 0 to 1*10^40-1 || [[QBASIC]] 1) |} 1) While QBASIC does make use of structured programming and thus doesn't need line numbers, it is still possible to run code with line numbers in QBASIC.
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)