[home] Anguilla Library Computer Club

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
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