What is Statement in Programming

Most computer programming languages ​​have a concept of statements. What is a statement in programming example? a statement is a command that is given by the programmer to the computer. An example of a statement in programming is:

print “Enroute to Mexico!”

A command contains the verb “print” along with other details (what to be printed). The print command means “display on the screen” and not necessarily to print on the printer. Programmers give instructions directly to the computer by typing them while a special program is running or creating text files with commands in them.

In a situation where you have more than one command in the file, each will be executed in top-to-bottom order. Therefore, the statement file will contain:

print “Enroute Mexico!”

print “Stranger in town”

The computer checks the first statement, determines that it is a printed statement, checks what needs to be printed, and displays this text on the computer screen. It will look like this: Enroute to Mexico!

Note that the quotation marks are missing. Their goal in the program is to tell the computer where the text starts and ends, the same as in English prose.

The computer then moves to the next statement, executes the command, and the screen looks like this:

Enroute to Mexico!

Stranger in town

After the computer reaches the end of the text file, it stops and waits for further instructions. This whole process is known as starting or running a program. When you start a program, the computer

examines your program files and takes the appropriate action for each expression.

There are several types of statements, depending on the programming language used. For example, there might be a beep statement that causes the computer to beep through its speakers or a window statement that causes a new window to appear.

In addition, the way statements are written varies by programming language. The Python programming language uses statements that look like the following.

puts (“Enroute to Mexico”);

puts (“Stranger in town”)

Few notable differences

Parameters (text in quotation marks used to specify what to display) are enclosed in parentheses.

Each statement in Python has a semicolon at the end of it.

The verb print entails “put a string”. A word string is a computer term for a piece of text. It is from the phrase “a string of letters”. “put” in this case means “put on the screen”.

This difference is quite shallow. A set of rules such as the first two is called the syntax of a programming language. This set of verbs is known as the library which is not different from grammar and natural vocabulary.

HOW DO I FIND MY NEXT READ?

Similar Articles

Comments

Ads

Most Popular