The difference between a variable and an identifier is the same as between a person and his name.
The variable is not an identifier. The variable has an identifier. It also has a type and (if initialized) value.
For example, the instruction:
bool isClosed = true;
declares and initializes a variable with the name (identifier) isClosed, enter bool and value true .
Of course, we usually say: "isClosed is a variable ..." "isClosed is true" ... but just like we say "Peter is a software engineer", "John is tired" ... that is, we refer to a variable by its name.
Daniel Daranas
source share