PRINT

PRINT is a command in all versions of Petit Computer/SmileBASIC. This command prints text to the screen.

Usage
PRINT accepts almost any type of variable or literal as an argument. Strings and numbers can be printed. :'number literal :PRINT 5 :'string literal :PRINT "HELLO WORLD!" :'variables :NUM=27 :TX$="words" :PRINT NUM :PRINT TX$ 5 HELLO WORLD! 27 words PRINT can display elements of an array, but an entire array cannot be printed. It will print the value of the variable with the same name instead. :ARR=3 'numeric variable :DIM ARR(5) 'array variable of same name :PRINT ARR(0) 'prints the element of the array, 0. :PRINT ARR 'treated as a numeric variable and prints 3.

Formatting PRINT
PRINT is one of the most flexible functions. You can print many things on one line, of different types. :PRINT 2,3 'Will print 2, then a tab, then 3. 2  3 :PRINT 7;6 'Will print 7, then right after print 6. 76 Both the comma and semicolon can be used without a second argument, to set the location for the next time something prints. This can break up text over multiple lines. :PRINT "Wow! "; :PRINT "Check it out!"; Wow! Check it out! The system variable TABSTEP can be used to determine how spaced the tabs will be. :FOR T=0 TO 5 : TABSTEP=T 'sets the size of a tab : PRINT 2,3 :NEXT 23 2 3 2 3 2 3 2   3 2    3 The color and location of text printed with PRINT can be set by COLOR and LOCATE. :COLOR 3 'sets color to yellow :LOCATE 13,12 'sets the cursor to start printing at x=13, y=12. :PRINT "Hello!" 'Prints "Hello!" at the set location. The current location of the cursor is determined by the system variables CSRX and CSRY. :LOCATE 13,12 :X=CSRX :Y=CSRY :CLS 'just so that the coordinates don't print AT the coordinates. :PRINT X,Y 13 12