Fun with PRINT
NEW 10 CLS 20 PRINT TAB(5); "I AM GREAT" 30 PRINT TAB(8); "BUT SLIMY SID" 40 PRINT TAB(12); "IS SNEAKY" RUN
PRINT TAB program
NEW 10 CLS 20 PRINT "HOW MANY SPACES" 30 PRINT "DO YOU WANT TO LEAVE?" 40 INPUT N 50 PRINT TAB(N); "HELLO" RUN
In this program you tell the computer how many spaces to leave before the word HELLO. The computer stores the number in the variable N,
and then uses N with the PRINT TAB command.
Note that TAB actually starts counting at 1 so TAB(1) starts at the beginning of the line, and you need to use TAB(2) to start with a space.
Try running the program above multiple times to see this.
Leaving empty lines
NEW 10 CLS 20 PRINT "HELLO" 30 PRINT 40 PRINT 50 PRINT 60 PRINT "GOODBYE" RUN
To make the computer leave empty lines on the screen you use PRINT by itself. This program makes the computer leave three empty lines between the two messages.
Birthday program puzzle
This program displays a birthday
message. Before you run it, you
must put the numbers in the
brackets after the PRINT TAB
commands. Experiment with different
numbers to see if you can put the message in
the middle of the screen.
NEW 10 CLS 20 PRINT:PRINT:PRINT 30 PRINT:PRINT:PRINT 40 PRINT TAB(??); "HAPPY BIRTHDAY" 50 PRINT TAB(??); "TO YOU" 60 PRINT TAB(??); "*****" RUN
Making columns
NEW 10 CLS 20 PRINT:PRINT:PRINT 30 PRINT "DAY", "MY LUNCH" 40 PRINT 50 PRINT "MONDAY", "CHOCOLATE" 60 PRINT "TUESDAY", "HAMBURGERS" 70 PRINT "WEDNESDAY" "ICECREAM" 80 PRINT "THURSDAY", "SAUSAGES" 90 PRINT "FRIDAY", "LOLLIPOPS" 100 PRINT "SATURDAY", "CHIPS" 110 PRINT "SUNDAY" "POPCORN" RUN