Hello, I have just a terminology question. I have read that if, foreach etc. are statements but what does it mean in the terminology - are these commands? It is maybe "lost in the translation" problem
In computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program is formed by a sequence of one or more statements. A statement will have internal components (e.g., expressions).
Many languages (e.g. C) make a distinction between statements and definitions, with a statement only containing executable code and a definition declaring an identifier. A distinction can also be made between simple and compound statements; the latter may contain statements as components.
In a nutshell it is one of many instructions in the language that makes the program to perform some very basic action. Through combining statements you define a complex activity that makes sense to you as an author. You define it by using little building blocks namely those statements.
A command and a statement is generally the same thing.
However, when talking about commands, it's usually something that a user enters directly rather than a statement in a program.
Also, while a command generally is an instruction to do something, a statement can also be instructions that doesn't actually perform anything, like for example declaring a constant value:
const int Answer = 42;
A statement is an expression that has no return value (or void or unspecified).