JSS 2 (BASIC PROGRAMMING LANGUAGE)

 


BASIC PROGRAMMING LANGUAGE

BASIC stands for Beginners All-purposed Symbolic Instruction Code. It was developed in 1964 by Professor John Kemeny and Thomas Kurtz to teach students at Dartmouth College. It has undergone series of historical development, which has resulted in several forms of the language.

Basic is an example of High level computer language.

VERSIONS OF BASIC

1.   BASICA

2.   GWBASIC

3.   Torbo BASIC

4.   Quick BASIC

5.   VB.NET

BASIC CHARACTER SET

1.   Alphabetic Characters – A to Z

2.   Numeric Character – 0 to 9

3.   Special Characters – 0 + % ^ # = ( ) etc

DECLARATION

This is the act of creating some storage location when programing.

WAYS OF DECLARATION IN BASIC

Variable and constant Declaration

 

1. Variable can be defined as a name that is used to represent some storage location. A variable is a quantity that changes during the execution of a program.

TYPES OF VARIABLE

1.     NUMERIC AND STRING VARIABLE

1.   Numeric Variables: These are used to store numeric values such as 23, 98, etc. There are two major types of numeric variables, which are; Integer variable and real variable

a.   Integers are whole numbers without decimal places.

b.   Real numbers are numbers with decimal places

 2.     String Variables: These are used to store alphabetic and alpha-numeric values.

HOW TO DECLARE VARIABLE

1.     Integer variable name are written with a “%” sign as the last character

2.      A string variable name is always written with a dollar sign ($) as the last character. E.g. Name$=”John”

 

RULES FOR CODING VARIABLE

1.   In BASIC combining alphabets, numbers and decimal point (a maximum length of 40 characters) may for variable.

 

2.   No reserve word can be used as a variable name.

3.   Special characters cannot be used for naming variable.

4.   A string variable corresponds to string data whereas a numeric variable corresponds to numeric data

5.   In a program, each variable is referred throughout the program by its name.

 

2.       CONSTANTS

A constant is data that remains the same as the program runs (executes).

BASIC allows two types of constants:

 

1.   Numeric constant: Numeric constant in BASIC is any signed or unsigned number.

2.   Alpha-Numeric or string constant: It consists of the combination of letters, digits, and other symbols that is treated in a manner completely analogous to numeric constant. They are enclosed within inverted comma

Rules for numeric constants

1.   A number can have maximum of 8 digits

2.   No comma is allowed

3.   A decimal point can appear anywhere

4.   If the value is quite larger it is expressed in exponent form

5.   No blank space, special characters or any other letter is allowed in the number.

Post a Comment

Previous Post Next Post

Contact Form