Expression

An expression is a piece of source code that produces a value at runtime.

Related concepts:  EvaluationValue

Closest Wikipedia entry:  Expression (computer science) — In computer science, an expression is a syntactic entity in a programming language that may be evaluated to determine its value. It is a combination of one or more constants, variables, functions, and operators that the programming language interprets (according to its particular rules of precedence and of association) and computes to produce ("to return", in a stateful environment) another value. This process, for mathematical expressions, is called evaluation.

Misconceptions about Expression
37 documented Misconceptions

Check Yourself
Misconception
ArithmeticPlusPrecedesJava
Addition has higher precedence than string concatenation
Misconception
ArrowFunctionNoImpliedReturnJavaScript
Even when an arrow function consists just of an expression, the return keyword must be explicitly written
Misconception
ArrowFunctionRequiresFunctionKeywordJavaScript
Arrow functions also require the keyword 'function'
Misconception
AssignComparesJava
= compares two values
Misconception
AssignmentNotExpressionJava
An assignment a=b is not an expression
Misconception
CannotChainMemberAccessesJava
Member accesses cannot be chained together
Misconception
CannotChainMemberToConstructorJava
Method calls or field accesses cannot be chained to a constructor invocation
Misconception
ChainedMethodsNotCalledFromOutsideJava
Chained methods are all called on the object at the beginning of the chain
Misconception
ComparisonWithBooleanLiteralJava
To test whether an expression is true or false, one must compare it to true or to false
Misconception
CompositeExpressionsUntypedJava
Expressions that consist of multiple parts have no type
Misconception
ConditionalOperatorNotExpressionJavaScript
The conditional operator is not an expression
Misconception
EqualityOperatorComparesObjectsValuesJava
o==p compares the objects referred to by variables o and p
Misconception
EqualsComparesReferencesJava
o.equals(p) compares the references stored in the variables o and p
Misconception
ExpressionAssignsJava
An expression that reads a variable also updates its value after the evaluation
Misconception
ExpressionsDynamicallyTypedJava
One has to evaluate an expression to determine its type
Misconception
IdentifierAsStringInBracketNotationJavaScript
An identifier used to access a property with the bracket notation is treated as a string
Misconception
InlineCallInExpressionTreeJava
The expression tree of an expression involving a call inlines the call's computation of the returned value
Misconception
InlineVariableInExpressionTreeJava
The expression tree of an expression involving a variable inlines the variable's definition
Misconception
LargeIntegerLongJava
Large integer numbers have type long
Misconception
LiteralNoExpressionJava
A literal is not an expression
Misconception
MandatoryAssignmentJavaScript
An expression must be assigned to have a valid statement
Misconception
MapToBooleanWithConditionalOperatorJava
To map a boolean expression to a boolean, a conditional operator is necessary
Misconception
NoAtomicExpressionJava
Expressions must consist of more than one piece
Misconception
NoAtomicExpressionJavaScript
Expressions must consist of more than one piece
Misconception
NoAtomicExpressionPython
Expressions must consist of more than one piece
Misconception
NoFunctionCallsChainingJavaScript
It is not allowed to chain function calls
Misconception
NoShortCircuitJava
&& and || always evaluate both operands
Misconception
ObjectsMustBeNamedJava
A variable is needed to instantiate an object
Misconception
OutsideInMethodNestingJava
Nested method calls are invoked outside in
Misconception
ParenthesesOnlyIfArgumentJava
() are optional for method calls without arguments
Misconception
PlusConcatenatesNumbersPython
The plus operator can concatenate strings and numbers
Misconception
RightToLeftChainingJava
Chained accesses are invoked from right to left
Misconception
StringPlusStringifiesExpressionJava
String concatenation stringifies non-String operand expressions
Misconception
TargetTypingJava
The type of a numerical expression depends on the type expected by the surrounding context
Misconception
ThisChildInCallExpressionJava
Instance method or constructor call nodes in expression trees have a child labeled "this"
Misconception
ThisNoExpressionJava
The name this is not an expression
Misconception
VariablesHoldExpressionsJava
= stores an expression in a variable

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.