Constant in QBASIC
A contstant is a variable whose value do not change during the execution of a program.
A constant is something a universal value like value of pi, value of g, value of G, value of e in science.
In QBASIC the constant can be declared by using CONST keyword.
Syntax:
CONST variable=Value
Types of Constant
A constant is something a universal value like value of pi, value of g, value of G, value of e in science.
In QBASIC the constant can be declared by using CONST keyword.
Syntax:
CONST variable=Value
Types of Constant
- Numeric constant
- String constant
1. Numeric constant:
A constant which can hold numeric value is called numeric constant.
e.g.
CONST pi=22/7
CONST g=9.8
2. String constant:
A canstant which can hold string value is called string constant.
e.g.
CONST N$="Ramesh"
CONST place$="Kirtipur 7, Kathmandu"
Note:
Keyword is a reserved word which has fixed meaning .
e.g.
CONST for declaring constant
PRINT for displaying value in console screen
Keyword is a reserved word which has fixed meaning .
e.g.
CONST for declaring constant
PRINT for displaying value in console screen
Comments