Introductory Basic Lesson Commands vs. Statements: BASIC makes a distinction between what are know as commands and statements. The PRINT statement tells the computer to display information in the screen for us to look at. So what's a command? We use commands to tell BASIC directly that we want it to do so mething for us. Normally, commands are typed in direct- ly, although it is possible for them to be used in programs. We just type in the command and BASIC goes and executes it. We dont use line numbers, as we would for statements in a program. Here are some of the most important commands that you will need to know to effect- ively write programs in BASIC: LIST RUN SAVE LOAD NEW LIST: When we want to look at a program that we have typed in, especially a large one, we use the LIST command. By typing LIST, we are telling BASIC that we want to see our program, to have it LISTed for us. BASIC responds by displa- ying the whole program on the screen, starting with the lowest line number and displaying lines in ascending order until the end of the program is reached If the program is large, it may scroll off the top of the screen as it is being listed. Type in this short prog- ram, which we will use to demonstrate how commands work. 10 PRINT "THIS PROGRAM WILL BE USED" 20 PRINT "TO DEMONSTRATE BASIC COMMANDS" 30 PRINT "IMPORTANT BASIC COMMANDS ARE" 40 PRINT "LIST" 50 PRINT "RUN" 60 PRINT "SAVE" 70 PRINT "LOAD" 80 PRINT "NEW" 90 END Be sure to hit the return key after each line that you enter. Now type LIST. The program that you just typed in is displayed on the screen. You can LIST an entire program, or only part of it. You can list individual lines, if you want. Try LIST 20. Line 20 will be LISTED. You can also LIST a range of lines by using the hyphen (-). Try this: LIST 20-60. Line 20-60 will be LISTED. You can LIST a program up to a certain point from the beginning. Try LIST -70. The program, up to line 70, is displayed. Finally, you can LIST a program from a certain point to the end. Try LIST 30-. What happens? Do you see how LIST helps you look at all or part of your program? RUN: RUN is the command that you give BASIC when you want your program to be translated into action by the computer, or to be EXECUTED. When BASIC executes your pr ogram, it starts with the lowest line number, and carries out the instuctions it finds on each line, in ascending order, until it reaches the END statement. What do you think the program you typed in will do when you type RUN? Type RUN ,and see if you were right. The program should have printed the following on the screen. THIS PROGRAM WILL BE USED TO DEMON- STRATE BASIC COMMANDS IMPORTANT BASIC COMMANDS ARE: LIST RUN SAVE LOAD NEW SAVE: After we have typed in a program we usually would like to save our work; otherwise, we'd have to type in the program in again every time we wanted to use i t. Fortunately, there are magnetic disks that we have to save pro grams on. When you save a program, you have to give it a name so that you can refer to it later if you want to use it. The name, or FILENAME, can be almost any combination of letters and characters, but it's a good idea to use a name that makes sense to y ou so you can more easily remember what the program is used for. You would use the SAVE statement like this: SAVE "filename",8. You substitute, where it says 'filename', the name for the prog ram that you have chosen. The name must appear in double quotes , as indicated. The comma and the 8 are used to tell BASIC t hat you want to save this program to disk (BASIC associates the DEVICE NUMBER 8 with your disk drive). For example, if you choose DEMO for a name, you would SAVE the program like this: SAVE "DEMO",8 Make sure that you have a formatted disk in your disk drive and the program will be saved. LOAD: LOAD is the exact opposite of SAVE. When we want to work on a program that we have previously saved to disk, we have to LOAD it into the computer. The comm and looks like this: LOAD "filename",8. To load the program that we just saved, assuming that it was named DEMO, we would type: LOAD "DEMO",8. The program will be loaded into memory for us to RUN, LIST, or edit. You have to use the exact name to load a program that you used to save it or else the the computer will not know what file you are looking for and respond with FILE NOT FOUND ERROR. NEW: What if you're done with a program and want to start working on a new one. This is where the NEW command comes in. It tells BASIC that you want to start wor k on a new program and to clear things out so you can start from scratch. Make sure that you have saved the example program, and now type NEW. Now try to LIST the program. What happens? Try RUNning it? What happens now? As you can see, BASIC has thrown out your program and doesn't know anything about it anymore. You can now start working on a new program, or you can bring back the old one, by LOADing it. Be sure to be very careful with the NEW command, or you might lose some work after working on it for a long time! Line Numbers: You may have wondered how you would get rid of a program line that you didn't want in the program anymore. With BASIC, deleting lines is very easy. All you have to do is type the line number that you want to delete and hit the RETURN key. The requested line will be deleted. If you have the sample progam saved, type 20 and hit RETURN. Now try listing the program. Line 20 should have been deleted from the program. That will wrap up this lesson. Try practicing these commands until you are confortable with them.