Statements
A free lesson from Swipe Coding · C++, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
A C++ program is made up of many small statements. A statement is a single instruction to the computer — for example "print this text" or "add these two numbers". Every statement ends with a semicolon ";".
std::cout << "Hello, C++!";
The semicolon works like a period at the end of a sentence: it tells the compiler "this statement is finished, the next one follows". Leave it out, and the compiler won't know where one statement ends and the next begins — it will report an error.
int main() {
std::cout << "Hello!";
std::cout << "How are you?";
return 0;
}Every statement in C++ must end with a semicolon.
At its core, a C++ program is simply a sequence of statements. The processor runs them strictly in order — from top to bottom, one after another. At this stage, there are no "shortcuts" or jumps yet — it's purely step-by-step execution.
Which character marks the end of a statement in C++?
Statements don't float around freely — they always sit inside a block enclosed by curly braces { }, such as the body of the main() function. You'll see exactly how these blocks work in the next lesson.
C++ executes a program's statements in order, from ____ to bottom.
Keep your streak going in Swipe Coding
Swipe through every level of C++ on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →