Basic Language System Commands


Neuro-linguistic programming, practical guide to nlp, modern methodologies and effective techniques to change your life by Ylich Tarazona . $ 19.00 from Smashwords.com

Continuation from "More on understanding basic language

SOME SYSTEM COMMANDS

 These commands are used without line numbers. They are executed as soon as we press the Enter Key. They are also called direct mode commands.

1. REM: REM is a short form of Remark; It is used to give heading for the program. It is a non-executable command. REM command can be given anywhere in the program.

SYNTAX
LineNo REM Comment

E.g.
10 REM This is a program for print 2 numbers
20 PRINT 5, 6
30 REM Now we can add the numbers
40 PRINT 5 + 6
50 END
RUN

OUTPUT
5      6
11
OK

2. CLS: CLS is a command used for clearing the screen. This command wipes out whatever is displayed on the monitor.

SYNTAX
CLS

E.g.
10 PRINT 4
20 PRINT 8
30 PRINT “JOHN”
40 END
RUN

OUTPUT
4
8
JOHN
OK
CLS
After CLS Command, the screen becomes clear of all data.

3. RUN: RUN Command tells your computer to read the program instructions and execute them. To execute RUN command, press the function key F2.

SYNTAX
RUN

E.g.
10 PRINT “LET”
20 PRINT “US”
30 PRINT “GO”
40 END
RUN
OK

OUTPUT
LET
US
GO

4. LIST: LIST command lists out all the instructions stored in the computer’s memory. It arranges a program in the ascending order and displays all the instructions. To execute RUN command, press the function key F1.

SYNTAX
LIST LineNo

E.g.
10 PRINT “WILLIAM”
20 PRINT “BERNAD”
15 PRINT “SHAKESPEARE”
25 PRINT “SHAW”
LIST

OUTPUT
10 PRINT “WILLIAM”
15 PRINT “SHAKESPEARE”
20 PRINT “BERNAD”
25 PRINT “SHAW”

5. NEW à New command wipes the old program from the computer’s memory. It is food practice to type NEW and press ENTER key before starting a NEW program.

SYNTAX
NEW

6. DELETE: As the name indicates, this command is used to remove any unwanted line from your program.
SYNTAX
DELETE

E.g.
10 PRINT 5
20 PRINT 3
30 PRINT 10
40 END
         
One line can be removed by typing DELETE 20.
Line no 20 will be removed from the memory.
Now LIST command should be used to view the program
10 PRINT 5
30 PRINT 10
40 END

POINTS TO REMEMBER


1. REM or REMARK statement is used as the heading of the title of the program
2. CLS command is used to clear the screen.
3. NEW command clears the program form the memory of the computer.
4. DELETE command is used to remove any line from the program.
5. RUN command executes the program.


More on "Understanding Basic Language "


This is a continuation from: Understanding Basic Language

Mathematical Operators
To carry out arithmetic operations in programming language, mathematical operators are used. Some of these operators are given below:

Operations        Operator
Addition               +
Subtraction           -
Multiplication       x
Division                /
Greater than          >
Lesser than           <
Exponential          ^
Non equal            <>

Expressions

An expression is something the interpreter calculates (or evaluates).
Some examples given below:
A = 24
B = 25
C = A + B (returns 49)

A = 120
B = 12
C = A / B (returns 10)

A = 34
B = 26
C = A - B (returns 8)


A = 200
B = 100
C = (A * 3) + B (returns 700)

A = 3
B = 2
C = A ^ B (returns 9)

 

Evaluate the following:


100 + 50/2 =
100 + 5 – 90 =
82 – (3 x 20 + 4) =
32 – 23 =
40 / 21 + (20 – 2) =

When the Basic Interpreter is loaded into the memory of the computer, the Basic Interface screen will open.


Type your first program:

10 PRINT “Welcome to the World of BASIC”

Press F2 to run the program. You will see the output as follows:

Press any key to return to the main screen.

Some Important Commands- A command tells the Basic Interpreter to perform a certain task.

PRINT: The PRINT command tells the Interpreter to print something on the screen. In the above case the interpreter prints – “Welcome to the World of Basic”.

Try the following examples

PRINT 5 + 10 * 2
25

PRINT “ROSE & LOTUS”
ROSE & LOTUS

PRINT “COMPUTER”
COMPUTER
                   
PRINT 3 ^ 2 * 5
45

PRINT “SACHIN”                                                 
SACHIN

PRINT “Rahul” ; “Dravid”
RahulDravid

PRINT “Rahul” , “Dravid”
Rahul Dravid
If a List of Instructions has to be given, line numbers will have to be used.

Try the following examples:

10 PRINT 100
20 END
RUN
100
OK

10 PRINT 15
20 PRINT 15 + 15
30 END
RUN
15
30
OK

10 PRINT “THE LOST”
20 PRINT “WORLD”
30 END
RUN
THE LOST
WORLD
OK

10 PRINT “ROHIT”
20 END
30 PRINT “RAM”
RUN
ROHIT
OK

END: The last statement of a program is END. END terminates the program. It means that the program is complete and the computer will ignore any line number given after the END statement.



POINTS TO REMEMBER
- PRINT statement displays anything written after it. It may be data or result.
- END statement is used to terminate the program.
- Once program is over, RUN command is given to execute the program.
- When a Computer has to do more than one calculation then it follows BODMAS Rule.

B à Brackets
O à Of
D à Division
M à Multiplication
A à Addition
S à Subtraction

State “True” or “False”
1) PRINT command cannot be given with line numbers.
2) For division we use “ / “ sign.
3) Non-Numeric data is displayed as it is.
4) The computer will ignore any line number given after END statement.
5) Non-Numeric information is written in double quotation marks.

Understanding Basic Language

Words on Paper by Michael Ross. $2.99 from Smashwords.com
"Life is not algebra but in life sometimes, just sometimes, two minuses make a plus." Two strangers, Emma and Will, are divided by a misfortune and feelings of pain that only they can understand, but sometimes an uneven broken road can lead people from tragedy to happiness. A modern love story, with hard edges, as two people battle through their mutual history to find each other.

What is a Program?

A computer can be given instructions in the form of a program. Program is a very common word in your day-to-day life also. For e.g. to post a letter you will
1. Get ready
2. Go to Post Office
3. Give money to the Post Master for stamp
4. Take stamp and fix it on the envelope
5. Post the letter in the letter box
6. Come back home

Here, set of instructions are listed step wise to post a letter. It means that a program was set for you. A set of instructions is called a program. 
We give data and instructions to the computer to do any task. We can define a computer program, as a set of instructions given to a computer to get desired result.

Need for a Programming Language

A language that is encrypted in binary numbers or a language similar to binary numbers that a computer’s hardware understands is understood more speedily by the computer. Languages that use English like statements are easier for programmers to use, but they have to be translated first so that the computer can understand it.
The person who writes the program for computer is known as Programmer and programs are known as Software. A computer follows the instructions given by the programmer to perform a specific job. To perform a particular task, a programmer prepares a sequence of instructions known as program, which is written in a programming language.

Program: A set of instructions given to the computer to execute a task is known as program and the process of writing is called programming. A person who writes programs is called a programmer.

BASIC - Beginners’ All Purpose Symbolic Instruction Code was developed by John G Kemeny and Thomas E Kurtz at Dartmouth College in U.S.A. in 1964. It is one of the simplest and easy to use computer languages. Basic is a High Level Programming Language, also termed as the Interpreter which reads one statement of a program at a time and executes appropriate instructions leading to some computations.
Basic is an interactive language, meaning it allows interactive communication between the user and the computer during the execution of programs.
Like other languages, computer languages also have grammar. Grammar used for any computer language is known as Syntax of that language.
We have to follow some rules and these rules are known as Syntax rules. While writing a program if we make a mistake in the syntax, then computer displays error message “Syntax Error”.
                                                                                                                            

Syntax Rules of Basic



1. Basic Program is made up of lines or statements. A new statement should be written on a new line.
2. All statements should have a line number.
3. Line number should be a positive integer (whole number).
4. No two statements can have the same line number.
5. Line number should be followed by Basic command.
6. Statements are executed in ascending order only.
7. Program should end with END command. END command should have the highest line number. Any line number after the END will be ignored.
8. Usually line numbers are given in the multiples of 10s.

We have to provide data to the computer in the form of a program. Data are made up of different characters.

Characters: Any sign or symbol is known as a character. The basic character set is made up of Alphabets, Numbers, and Special signs. For e.g. A to Z, 0 to 9, # “ $ etc. Blank space is also considered as a character.

Data: Data is a fact. Data consists of character set. Data is processes to get information. Processed data is called result. Data is of two types: Numeric and Non-Numeric.

Numeric: This information has only numbers. These numbers can be positive, negative, fractional or integer. Information regarding age, time, height, weight will always be a number. Numeric data is used for mathematical calculations e.g. 45. 67.7. 34x4, 89+4 etc.

Non-numeric: This information consists of numbers, alphabets or any other special sign. Non numeric information is generally written in quotation marks in the computer programs. With non-numeric information one cannot do Mathematical calculation. E.g.”Roshan” , “45 apples “ , “ $%”.

Process: Process means work done on the information.

Result: The processed data are called result.            NEXT PAGE>>