Statement
A statement is a complete instruction that tells a program to perform an action. It is a line of code that the computer executes.
Why statements are important
Programs are made of statements.
Each statement performs a specific task, such as:
Assigning a value
- Calling a function
- Making a decision
- Creating a loop
Without statements, a program cannot run.
Simple examples
Assignment statement:
This statement assigns the value 10 to the variable score.
Function call statement:
This statement executes a function.
Conditional statement:
This statement controls program flow.
Statement vs Expression
- Expression → produces a value
- Statement → performs an action
Example:
The expression creates a value. The statement uses it to do something.
Types of statements
Common types include:
- Assignment statement
- Conditional statement
- Loop statement
- Return statement
Programs are built by combining many statements.
Why learning statements matters
Understanding statements helps you:
- Structure programs correctly
- Control program behavior
- Organize logic clearly
- Avoid syntax errors
Statements are the building blocks of any program.
Simple example
Think of a statement like a command:
“Turn on the light.” “Open the door.” “Add 5 to the number.”
Each command is a complete action.
Related terms
- What is Parameter?
- What is Return Value?
- What is Scope?
Source
Simplified from general programming documentation and Wikipedia.