A q- basic program consists of various elements .
The are :-
A Character set
Constants
Variables
Statements
Operators and expressions .
Character set :-
With respect to computer lessons . The q basic character set
consists of :-
Alphabets from A – Z and a-z
Numbers from 0 – 9 and
Special character + , - , * , < , > , = , ’ , ” , / , ^ , # , $ , % , , etc .
Constants :-
A constant is the fixed value which is used in the program . They
are two type :-
102 . Numeric constants : Numeric constants is a numeric value
which is used in a program .
For example :- 104 , 102.50 , 710456 etc .
103 . String constants : String constant is a sequence of character
which is used in a program . It is the collection of numbers or texts
or a combination of both text and numbers .
From example : - “Hello”, Computer “ , etc .
Variable
A variable is a location in the memory , which has been assigned a
name , and it used to store data temporarily . It holds the value
until another value is assigned to it .
There are two types of variable :-
1. Numeric Variable :- It can hold only Numeric value , for
Example :- A , B , A1 , ABC , _ 4 etc .
2. String Variable :- It is represented by an alphabet followed by
the dollar ($) Sign . IT contains letters , digits , Underscore but
the last character is always a $ .
For Example :- B3$ , OP1$ etc .
Operators :-
Operators are the symbol that indicate the type of operation . Q
basic has to perform on the data or on the values of variables .
There are three types of operators in Q basic . They are :-
Mathematical operators :- The table contains the types of
mathematical operators available in Q basic .
Operator Meaning
+ Addition or unary plus
- Subtraction or unary Minus
* Multiplication
/ Division
% Modulo Division