[home] Anguilla Library Computer Club
Resources

BASIC Lesson #2: Get Data, Display Information

This lesson is the second part of a series on the BASIC programming language. In this lesson we would like you to explain what instructions the computer performs for each line of the program. Remember what you learned in lesson #1: A computer language is a way of specifying exactly what a computer should do, step by step. There are some new commands you will see in the program. The CLS command tells the computer to clear the screen; the REM command accepts the line as a remark/comment and not as an instruction to perform. Can you look up the COLOR command in the help (Shift-F1)?

Activity: The "Create a Story" Program

If there is plenty of time, type in the program below and save it under your name by pressing Alt-F for the File menu list and then A for Save As. If time is short, use Alt-F O to open the pre-typed program in \lcc\basic02.bas. When you are ready to try running the program, press F5 (function key #5).
REM This is a simple Program.  Can you Say what it does for each line?

10 CLS
                                ______________________________________
COLOR 6, 9
                                ______________________________________
20 INPUT "What is your name"; name$
                                ______________________________________ 
30 CLS
40 INPUT "How old are you"; age
                                ______________________________________
50 CLS
PRINT "OK "; name$; ", you are "; age; " years old."
IF age > 17 THEN PRINT "With age comes maturity."
PRINT "Now lets get some important information to record"

                                ______________________________________
60 INPUT "What is your favorite color"; color$
                                ______________________________________ 
70 INPUT "Who is your favorite singer"; singer$
                                ______________________________________
80 INPUT "What is your favorite sport"; sport$
                                ______________________________________
90 INPUT "Where do you live"; live$
                                ______________________________________ 
COLOR 9, 12
CLS
PRINT "Long, long ago, lived someone by the name of "; name$; ","
PRINT "who lived in Anguilla in a village called "; live$
PRINT "and enjoyed listening to "; singer$; " and "; sport$;
PRINT " on a "; color$; " radio."

                                ______________________________________
120 END