How to use the memory in BASIC?
Remember! Data are store in memory variables or constants. In Qbasic
variables should respect the following rules:
- The length should not be greater than 40 characters
- They should start with a letter
- They should not contain spaces
- They do not support certain characters such as (
If you don't put a suffix, BASIC considers the variable as being of
The table below shows the different types of variables:
- The first 4 types are used to store numbers.
- The Single-precision & double-precision types store floating
- The integer & long-integer types store integers (numbers without
- The String variables store characters, letters, texts, sentences.
|a% = 10
the value 10 to variable a%.
text "Hello friend" in the memory variable message$.
number1 = 10
number2 = 15
sum = number1 + number2
Assigns 10 to variable
Assigns 15 to variable
Assigns 25 to variable
|b% = 4.5
case BASIC will truncate the decimal part of the number and store
only 4 in the memory. Note:- Though this is a mistake, BASIC won't
generate an error message.
variables are used to store floating points.
|c = 10.123
above. When a variable has no suffix, it is considered as being a
[ Previous Index