DEV Community

Okanu Gracious
Okanu Gracious

Posted on

Statements in Programming

What are Statements?
A statement is the smallest unit in an imperative programming language. It is formed by a sequence of one or more statement. A statement will have internal components called expression.

A definition is different from a statement in that a statement contains executable code while definitions declare an identifier.

Types of Statements
1. Simple Statements
•assignment: A:= A+1
•call: CLEARSCREEN()
•return: return 1;
•goto: goto 2
•assertion: assert(ptr != NULL);

2. Compound Statements
•block
•if-statement
•switch-statement
•while-loop
•do-loop
•for-loop

3. Assignments Statements
An assignment statement sets the value or changes the value stored in the storage locations denoted by a variable name.

Thank you for reading this article.

Top comments (0)