Skip to content
BENIBIX Learn

Statement

Development🧩 Programming ConceptsPrograms

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

Think of it like

Think of it like one line in a to-do list. Each line is one thing to do.

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.

Definition

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 code

python
age = 12          # statement 1
age = age + 1     # statement 2
print(age)        # statement 3, prints 13
Three statements, run from top to bottom. The last one prints 13.

Common mistake

Mixing up a statement and an expression. A statement does a job. An expression gives back a value.

Key takeaways

  1. 1
    One step. Each statement is one thing for the computer to do.
  2. 2
    Top to bottom. Statements run in the order they are written.
  3. 3
    Can hold others. An if or a loop wraps more statements.

Compare

Learn it properly