Smart BASIC language is very simple. It has only two variable types - numeric and string.
Numeric variables are used for calculations and numbers storage:
Code: Select all
A = 2
B = A * 3
Code: Select all
T$ = "Hello!"
Besides variables, smart BASIC uses commands and functions.
Commands perform some task, for example PRINT command prints text on the screen:
Code: Select all
PRINT "This is a text"
Code: Select all
INPUT "How old are you?" : YEAR
PRINT "I already know that you are " & YEAR & " years old"
PRINT "Next year you will be " & (YEAR + 1)
Code: Select all
PRINT "You have " & DEVICE_TYPE$ ()
PRINT "with screen size " & SCREEN_WIDTH () & " points"
FOR PROGRAMMERS
Smart BASIC does not require variables definition and also allows usage of numeric variables in string expressions and string variables in numeric expressions. Smart BASIC automatically converts between text and numbers in expressions and commands parameters, so it is correct to write:
A = 2 + "3"
or
T$ &= SIN (X)
EXERCISE 1
Write a program which asks user the sizes of two catheti and prints on screen the size of hypotenuse of this right triangle.