Variable in QBASIC

A variable is a quantity which can store value in computer memory. A variable is also a quantity whose value changes during the execution of a program. Like in mathematics a variable holds certain value Just in QBASIC; it is a placeholder for storing value in computer memory. 


Some rules for making variable

  1. The first character always start with letter (i.e. lowercase or uppercase letter).
  2. The first character should not begin with numbers (i.e. numeric character).
  3. The string variable always ends with dollar ($) symbol.
  4. The maximum variable length must be 40 characters
Types of variable
  1. Numeric Variable
  2. String Variable
1. Numeric variable:
A variable which can store numeric value is called numeric variable.
e.g.
A=12
pi=3.14
c=79.89


2. String variable:
A variable which can store string variable is called String variable. String is a array of character enclosed within the double inverted comma.
e.g. 
N$="ram" 
Place$="Kirtipur Kathmandu"


Note:
A string variable always ends with $ symbol.

Comments

Sujan said…
Thank you so much;)
Yogesh Adhikari said…
The answer of string variable is not correct as my opinion. "The variable which can store string variable is called string variable." It should be: "The variable which can store string "value" is called string variable".

Popular posts from this blog

PROGRAM TO FIND SQUARE, CUBE, SQUARE ROOT AND CUBE ROOT OF GIVEN NUMBER

PALINDROME AND ARMSTRONG PROGRAMS

PROGRAM TO DISPLAY SUM, PRODUCT, DIFFERENCE AND PRODUCT OF TWO / THREE NUMBERS