Elements of BASIC Language

Elements of BASIC Language
    1.Character set
    A BASIC language, as any other language, has its own alphabet or character set. All the quantities defined and used in BASIC are constructed by using the character set.
    The character set in BASIC are
    Letter A, B, C… Z
    a ,b ,c …z
    Digits
    0, 1, 2 … 9
    Special Characters
    + - * / ( ) = . , $ < > ;
    Blanks
    In the text, we shall denote a blank by the character ^.
    Eg. 30 PRINT “GOVIND”; “^”; “SINGH”
    Quote
    ‘(Single Quote) or “(Double Quote)
    [;
    different quantities appearing in the list of the PRINT statement can be separated by semicolons]
    2. Constants and Variables
    Constants
    The quantities whose value cannot be changed in a program are referred to as constants.
    There are two types of constants.
    1. Numeric Constants.
    2. Non-numeric or Literal or String constants.
    a.Numeric constant
    A constant consists of the number 0, 1, 2 … 9
    There are two types
    1. Integer Constant
    2. Real Constant
    1.Integer Constant
    A number without an explicit decimal is called integer constant (i.e. whole number). Eg. 1, 20, 300.
    2.Real Constant
    The number includes a decimal point.
    Eg. 22.33.
    .33 is called its fractional part and 22 is its integer part. The number can be positive or negative. The sign always precedes the number. If the values is a positive number, it need not be specified as + 12.12. By default if no sign is appearing, then it is taken as a positive quantity.
    b.String Constant
    Letters and Digits enclosed with quotes.
    Eg. “345”, “TNAU”

Last modified: Wednesday, 18 January 2012, 11:14 PM