Skip to content
BENIBIX Learn

Statement vs Expression

A statement does a job, like storing a value. An expression only works out a value, and a statement then uses it.

Development🧩 Programming Concepts

Statement

One whole step in a program. Each is like a line on a to-do list.

A statement is one complete step that tells the computer to do something. It might keep a value, show a word or add two numbers. In many languages each statement sits on its own line. The computer runs statements one after another, from top to bottom. Some statements hold others inside them, like a loop or an if.

Example
Jack's program has three statements. The first keeps a number, the second adds one, the third prints the result.
Why it matters
Reading code means reading statements in order. Once you see each one as one step, any program gets easier.
Full entry
Development🧩 Programming Concepts

Expression

A piece of code that works out to one value, like 3 + 4.

An expression is a piece of code that works out to a value. 3 + 4 is an expression, and its value is 7. A name of a variable is an expression too, and so is a question like age > 10. The computer works out the value, then uses it. Expressions often sit inside statements, the way a sum sits inside a sentence.

Example
In price * 2, the computer looks up price, doubles it and gets 20. That 20 is the value of the expression.
Why it matters
Most of what a program computes happens inside expressions. Reading them well is reading what the code really does.
Full entry

In one line

Statement
One whole step in a program. Each is like a line on a to-do list.
Expression
A piece of code that works out to one value, like 3 + 4.