“MSX BASIC” COLUMN by Orazio Cacciola (part 1)
The PRINT statement
Hello everybody,
starting today a new column begins, in which I will explain MSX Basic commands and functions that will be used to make our programs. For experts it will be a refresher, while for those who are beginners, they will have the opportunity to understand and learn their use. I will try to explain at least one a week.
Let's start with the PRINT function
Print a sentence, number or variable. It can print on screen, on paper or on magnetic media
Its syntax is: PRINT [argument]
Using it alone will cause a line to skip. If we want to print a message we should enclose it in quotation marks: PRINT “Hello”. If we want to print on paper just add the L in front: LPRINT “Hello”. If we want to print it or rather the correct word is to save it on magnetic support, just add the pound sign: PRINT #1, “CIAO”. The number after the pound sign is the open port for writing to magnetic media.
We can also do some calculations: PRINT 5+6; will print the result of the sum. Instead of constants we can use variables: A=5, B=6, PRINT A+B. We can print sentences and numbers at the same time: PRINT “How old are you?”; 30, or a variable, A=30: PRINT “How old are you?”; A. You can concatenate 2 sentences or more sentences using the + (plus) sign; PRINT “Orazio”+”Cacciola”. OrazioCacciola will be printed, if we want to detach it just add an empty space after the name: PRINT “Orazio “+”Cacciola”. In addition to the plus sign, other tabulators, the comma sign and the semicolon, can be used. The comma leaves spaces between the 2 variables and exactly 14, while the dot and joins the 2 variables. Be careful though, while the semicolon joins the variables, whatever they are, the + sign can only be used with alphanumeric sentences or variables.
The next episode will be dedicated to PRINT USING, the so-called formatted printing.
Until next time
Orazio Cacciola

