Basic means beginners All-purpose Symbolic Instruction Code, developed by Professors John Kemeny and Thomas Kurtz at Darmouth College, U.S.A., in the year 1964. The language was developed with aim of teaching students a simple computer language for programming the computer.
Unlike some other languages, such as Rpg - for generating business reports, Snobol - for handling textual or string data, that are restricted in usage, Basic can be used to solve varied problems covering a wide range of applications on many different types of digital computer.
The language is an interpreted language, although there are some versions with compiler being used as the language translator. The translator enables the production of executable codes from the source program. Both interpreters and compilers are high-level language translators.
This language is designed for beginners to write codes to solve simple and complex problems. Though it was designed for beginners, professionals to write scientific and business programs can use it.
Variations of Basic
There are variations of Basic. The variations are as a result of extra features introduced into the language to enrich the language. These features are introduced to enhance the language capability of support areas, such as file processing, structured programming, graphics, sound, etc
These variations of the language are known as dialects. That is, there are various dialects of the Basic such as Qbasic, Gw-basic, Turbo Basic, etc. Qbasic was developed by Microsoft Corporation, U.S.A., and can be found on many computers today.
Major Applications of Basic
Basic is a general-purpose high-level language, designed to solve wide range of problems. The language can be used to solve scientific and engineering problems. Equally, it is use in the business environment is possible of the file processing features of the language.
Other areas, such as String manipulation, Education - as teaching aid, will find the language useful.
Elementary Data Types, Value and Variables
Basic has a naming style for its variable names, which is discussed below. Also, BASIC support two main classes of data, that is, numeric and string data.
Elementary Data Types
As mentioned above, the data types supported by BASIC fall under two umbrellas - numeric and string.
Numeric
The numeric data types can be further broken down into integers, real, octal and hexadecimal numbers. The numeric data types can be written in different ways. These ways include having a number with sign, a decimal point or expressed in an exponential format.
An integer number contain only digits; neither decimal nor exponent can be entertained, that is, integers are whole number. For example +16, 82. -100 etc.
Real numbers are floating point numbers, that is, numbers with digit(s) after the decimal point. For example, +10.21, 0.15, -11.2 are valid real numbers.
It should be noted that both types of numeric numbers can carry a sign + or -, however if the number is positive then the + sign can be omitted. No spaces or comma are permitted in either type of numbers.
String
A string is a sequence of characters (i.e. letters, digits, and special characters) enclosed within quotation marks. Both uppercase and lower case is permitted. BASIC is not case sensitive.
Variables
Variables are used as containers for values or constants. They symbolic memory locations.
To form a variable name in BASIC, certain rules must be followed. The rules are state below.
The first character must be an alphabet
Subsequent characters can be mixture of alphabetic characters and/or digits.
For a character string variable name, the last character must be a dollar sign ($)
Examples of valid variable names are:
Numeric:
A, ANS, ans, B9, C45Z
The following are invalid variable names:
9A, AN_S, B9 C, A $, 4AN$
These names are invalid because they all contradict the rules guiding variable name formation. The first name, started with a digit, the second has a special character - an underscore - as part of the name, the third as a space within the name etc.
At this point, it is important to state that some special characters are allowed in a variable name. These characters denote the types of data or variable.
The characters are:
! Denote a single precision e.g. Amt!
# Denote double precision e.g. Amt#
% Denote an integer e.g. Counter%
$ Denotes a string as explained earlier.
Operators
An operator is a symbol that tells the interpreter/complier certain mathematical or logical operation that has to be performed on a data value called operand.
The operations supported in BASIC can be classified as arithmetic, relational and logical operators.
Arithmetic Operator
The arithmetic operations are +, -, *, and /. These operators exist in other languages like Fortran, C, etc
Precedence and Associatively
In Fortran, there is hierarchy of operations while evaluating an expression. In Basic, the order in which operations having the same precedence are evaluated is referred to as associatively.
Arithmetic Expression, Assignment Statement and Assignment Operators
Arithmetic expressions are evaluated following the precedence rules describe above. Thus the arithmetic expression I/J*K is evaluated first, by dividing I by J and then multiplying the results of the evaluation with K. The general form of assignment statement is:
Let variable name = expression
Where the Let (a reserved word) is optional.
In an assignment statement, an equal sign (=) is used to indicate an assignment. The expression on the right hand side of the equals sign is evaluated first and the value is assigned to the variable name appearing on the left hand side. Considering the following statement.
Netpay= Sal + Allow + (Tip * (Transp - Taxi)
The expression on the right-hand side is evaluated as follows:
The terms with the innermost parentheses, Transp - Taxi is evaluated and the result is multiplied by the variable Tip.
The expression is evaluated from left to right by adding Sal and Allow to the result of the expression with the parentheses that was evaluated first.
The result of this evaluation is assigned to the variable Netpay.
Consider another example,
K = (T/ (P-Q)) + M
The expression on the right hand side of the equal sign is evaluated as follows:
Firstly, Q is subtracted from P:
Secondly, T is divided by the result of the subtraction:
Thirdly, M is added to the result of the second evaluation.
Fourthly, assign the last result to the variable K.
Data Type Conversion When different data types are mixed in an arithmetic expression one of the operands (or variable name) will be converted to the other type so that both of them are of the same type. Reading right to left, the conversion order is as stated below:
int < real < double precision
If the ranking is double precision, the other variables ( regardless of the type) are converted to double and the result will be double.
If the ranking variable is real, the other variable will be converted to real and the result will be a real number.
Published by Frank dave
Bsc Education View profile
- Create a Family History Scrapbook with Your Family Tree InformationOne amazing thing that can be created with the information you obtained while researching your family tree is a scrapbook. A family history scrapbook is a great way to educate your family, for generations to come, on...
- Remarkable Events in Music History: A 365 Day TimelinePamela Anderson Lee's wedding outfit (a white bikini), Debbie Gibson's halloween Seances, and Pres. Nixon's favorite Johnny Cash tune. Learn while you laugh. A music event timeline, covering the craziness of rock hist...
- Black History Month Events in DallasThe City of Dallas and surrounding areas have many events and shows to celebrate and experience black history month this February. For 2006, the theme is to be "Celebrating Community: A Tribute to Black Fraternal, So...
- Andover, NH: Small Town, Big HistoryThe neighborhood history is a heartfelt reminder of days gone by to long time residents. If you are new to Andover, it is a way to learn more about the community you have joined.
- The Best of Butte, Montana: Mining and HistoryButte, Montana has a rich history as a mining town in America's Old West. Here is a list of must-see attractions while visiting Butte.
- History of the Ba'th Party in Iraq and Syria
- A Basic Introduction to Wicca Religion
- History of the Ba'th Party in Iraq and Syria
- A Brief History of the Early Origins of the Conflict Between Islam and India
- Teach Yourself a Foreign Language
- History Tells Us Why Filipinos Worship Foreigners
- Don't Know Much About History
- Brief History of Basic
- Variations of Basic
- Elementary Data Types




1 Comments
Post a Commentits ugly