In programming, what is an expression?
In Javascript:
An expression is any valid unit of code that resolves to a value.
Conceptually, there are two types of expressions: those that assign a value to a variable and those that simply have a value.
The expression x = 7 is an example of the first type.
This expression uses the = operator to assign the value seven to the variable x. The expression itself evaluates to seven.
The code 3 + 4 is an example of the second expression type.
This expression uses the + operator to add three and four together without assigning the result, seven, to a variable.
JavaScript has the following expression categories:
- Arithmetic: evaluates to a number, for example 3.14159. (Generally uses arithmetic operators.)
- String: evaluates to a character string, for example, "Fred" or "234". (Generally uses string operators.)
- Logical: evaluates to true or false. (Often involves logical operators.)
- Object: evaluates to an object. (See special operators for various ones that evaluate to objects.)"
Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
here is Microsoft's explanation of expressions in .NET