Input/Output
CLEAR Clears the screen.
PRINT "Mark & Edna Schack" puts Mark & Edna on the screen.
PRINT TAB (5,10) tabs down 5 lines vertically and 10 spaces horizontally.
PRINT "Mark";
prints Mark Schack on the screen.
PRINT " Schack"
The ; suppresses the carriage return and line feed.
PRINT "Mark",
prints Mark
Schack. The , puts "Schack" in the next print field.
PRINT " Schack"
INPUT A$
program stops until the user types a word and presses RETURN.
A$ takes the value of the typed word.
GET KEY A A takes the value of the next character typed without pressing RETURN.
Branching, Conditional, and Program Control
GOTO 50 sends computer to do line 50.
IF answer$="a" THEN GOTO 500 sends computer to line 500 if the string variable answer$ is equal to a.
IF X=6 THEN GOTO 500 sends computer to line 500 if the variable X is equal to 6.
IF X<6 THEN GOTO 500 sends computer to line 500 if the variable X is less than 6.
IF X<>6 THEN GOTO 500 sends computer to line 500 if the variable X is not equal to 6.
END must be used in last line of program.
STOP stops execution of program. Any number of stop statements may be used.
Non Executable Remarks
REM The computer will ignore this remark. ! Does the same thing.
Counting, Looping, and Timing
FOR i=1 TO 50000
counts to 50000. Used for time delay.
NEXT i
FOR i=4 TO 1 STEP -1
counts down and prints 1,2,3,4 in a column.
PRINT i
NEXT i
Variables
LET x=5 variable x becomes equal to the numeric value 5.
LET name$="Mark Schack"
variable name$ becomes equal to the text string Mark Schack.
The $ suffix means a string (text) variable rather than a numeric
value.
LET answer$=CHR$(answer)
string variable answer$ becomes equal to the character represented
by the numerical
value (ACSII) of the variable answer.
Arithmetic Operations
+ - * / add, subtract, multiply, divide
PRINT x = 12/3 prints quotient of 4
PRINT SQR(x) prints square root of x
PRINT 3^2 prints 9 (3 squared)
RANDOMIZE
prints a random integer
PRINT INT(RND * 10)
between 1 and 9.
Graphics
SET WINDOW 0,100,0,100 formats graphic screen for 100 X 100 array
PLOT LINES: 30,10; 30,40 draws line from x,y coordinate 30,10 to 30,40.
SET COLOR 12 changes color to one of 256 possible hues
This glossary contains some of the most commonly used TrueBasic
instructions, but it is not complete. For more information click
here.