BASIC PROGRAMMING LANGUAGE
BASIC is a high-level programming language used for creating simple programs, performing calculations, and automating tasks.
It enables users to write code for data processing, file handling, and solving mathematical problems.
Example:
Write a BASIC program to ask a question and check if the answer is correct
10 PRINT "What is 5 + 3?"
20 INPUT A
30 IF A = 8 THEN PRINT "Correct!"
40 IF A <> 8 THEN PRINT "Try again!"
50 END
BASIC CHARACTER SET
The character set for the BASIC programming language includes:
-
Alphabets: A-Z, a-z for variables and keywords.
-
Digits: 0-9 for numbers.
-
Special Characters: Arithmetic operators (+, -, *, /), comparison operators (>, <, =), punctuation marks (e.g., ;, ,), and parentheses () for grouping expressions.
-
Whitespace: Space, tab, and newline for separating statements and improving readability.
KEY AND KEY BASIC STATEMENTS
-
PRINT : Outputs text or values to the screen.
Example: PRINT "Hello, World!"
-
INPUT : Prompts the user for input.
Example: INPUT A
-
LET : Assigns a value to a variable (optional in some versions of BASIC).
Example: LET A = 5
-
IF...THEN : Executes a statement based on a condition.
Example: IF A > 10 THEN PRINT "Greater"
-
FOR...NEXT : Loops through a block of code a specified number of times.
-
GOTO: Jumps to a specific line number in the program.
Example: GOTO 10
-
END: Marks the end of the program.
Example: END
-
REM: Adds a comment to the program (ignored during execution).
Example: REM This is a comment