top of page

BASIC Programming Language

BASIC Stands for

"Beginner's All-purpose Symbolic Instruction Code."



BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use. They wanted to enable students in fields other than science and mathematics to use computers. At the time, nearly all use of computers required writing custom software, which was something only scientists and mathematicians tended to learn.


BASIC originally used numbers at the beginning of each instruction (or line) to tell the computer what order to process the instructions. Lines would be numbered as 10, 20, 30, etc., which would allow additional instructions to be placed between commands later on if needed. "GOTO" statements enabled programs to loop back to earlier instructions during execution. For example, line 230 of a BASIC program may have an "if" clause that tells the computer to jump back to line 50 if a variable is less than 10. This instruction might look something like this:

230 IF (N < 10) THEN GOTO 50

BASIC Commands

Here are some of the commands associated with the earliest BASIC languages developed at Dartmouth:


HELLO — log in BYE — log off BASIC — start BASIC mode NEW — name and begin writing a program OLD — retrieve a previously named program from permanent storage LIST — display the current program SAVE — save the current program in permanent storage UNSAVE — clear the current program from permanent storage CATALOG — display the names of programs in permanent storage SCRATCH — erase the current program without clearing its name RENAME — change the name of the current program without erasing it RUN — execute the current programs STOP — interrupt the currently running program



Example:

10 INPUT "What is your name: "; U$
20 PRINT "Hello "; U$
30 INPUT "How many stars do you want: "; N
40 S$ = ""
50 FOR I = 1 TO N
60 S$ = S$ + "*"
70 NEXT I
80 PRINT S$
90 INPUT "Do you want more stars? "; A$
100 IF LEN(A$) = 0 THEN GOTO 90
110 A$ = LEFT$(A$, 1)
120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
130 PRINT "Goodbye "; U$
140 END

output:

What is your name: Mike
Hello Mike
How many stars do you want: 7
*******
Do you want more stars? yes
How many stars do you want: 3
***
Do you want more stars? no
Goodbye Mike


Source: wikipedia


The Tech Platform

0 comments
bottom of page