Statement is when you declare a variable, function, method, class, or the like.
Instruction is what you instruct the program to perform a certain action.
Statements are not usually considered statements because they say something that explains to the compiler or interpreter where certain data is written or what the format is. It's not usually something to be directly executed and it's going to have some kind of effect somewhere.
The instructions are things to do at certain times and that have some kind of effect: change values of variables, allocate or (depending on the language) deallocate memory, modify the state of the execution stack, perform some type of input or output, etc. Declarations do not do this, as they are not executable, they just name some things.
It's true that you can have something like this, depending on the programming language:
var x = 123;
In this case, the statement is var x
and initialization is x = 123
. Initialization is an assignment type that is a type of statement. In this case, this line contains a statement and an instruction. They could be separated with this equivalent:
var x;
x = 123;
In Python specifically, the use of class MinhaClasse:
is a class declaration, whereas def meu_metodo():
is a method declaration. Python does not require declaration of variables in other cases, but these are required in other programming languages, especially those that have static typing, such as C, C ++, Java, C #, Pascal, Delphi, Rust among many others. / p>