Each programming language has various types of elements, which are essential to write a programs. QBASIC also consists such programming elements and proper rules for preparing effective programs. The following are the basic Elements of QBAIC Programming language.
The QBASIC Character Set consists of letters, numbers and special characters.
Variable is a data item which can store some values such as numbers or string. It is a name of storage location in the computer's memory, in which we can store different values. It may change during the program execution time. There are two types of variables. They are:
A) Numeric Variable
The variable which is used to store numeric data is called numeric variable. Numeric data means numbers that can perform mathematical calculations. For example x = 5, here the variable x is stores the numeric value 5.
B) String Variable
A variable that stores string data is called string variable. String is the collection of letters, numbers and special symbols enclosed in double quotes. String data means alphanumeric values that cannot perform mathematical calculations. The string variable name must begin with alphabets and should always end with a $ sign. For example name$ = "Technical School", here the variable name$ stores the string value "Technical School".
Constants are the fixed value which remain unchanged during the program execution time. There are two types of constants. They are:
A) Numeric Constants
Numeric constants includes positive or negative number values. These values can be used in mathematical calculations such as addition, subtraction, multiplication and division. For example x = 5, here 5 is a numeric constants. Some valid numeric constants are 5, 10.5, -34 etc.
B) String Constants
A string constant is a set of alphanumeric characters, which are enclosed within double quotation marks. For example name$ = "Technical School". Here "Technical School" is a string constants. Some example of string constants are: "14 years", "3 boyes", "Nepal" etc.
Keywords are the collection of commands, statements or functions which are used to accomplish the particular job. Some example of QBASIC keywords are CLA, INPUT, PRINT, KILL, END, FOR, DO etc.