Expression
An expression is a piece of source code that produces a value at runtime.
Related concepts: EvaluationValue
Closest Wikipedia entry: Expression (computer science)
Misconceptions about Expression51 documented Misconceptions
Check YourselfArithmeticPlusPrecedes — Java
Addition has higher precedence than string concatenation
AssignCompares — Java
= compares two values
AssignmentNotExpression — Java
An assignment a=b is not an expression
CannotChainMemberAccesses — Java
Member accesses cannot be chained together
CannotChainMemberToConstructor — Java
Method calls or field accesses cannot be chained to a constructor invocation
ChainedMethodsNotCalledFromOutside — Java
Chained methods are all called on the object at the beginning of the chain
ComparisonWithBooleanLiteral — Java
To test whether an expression is true or false, one must compare it to true or to false
CompositeExpressionsUntyped — Java
Expressions that consist of multiple parts have no type
EqualityOperatorComparesObjectsValues — Java
o==p compares the objects referred to by variables o and p
EqualsComparesReferences — Java
o.equals(p) compares the references stored in the variables o and p
ExpressionAssigns — Java
An expression that reads a variable also updates its value after the evaluation
ExpressionsDynamicallyTyped — Java
One has to evaluate an expression to determine its type
LargeIntegerLong — Java
Large integer numbers have type long
LiteralNoExpression — Java
A literal is not an expression
MapToBooleanWithConditionalOperator — Java
To map a boolean expression to a boolean, a conditional operator is necessary
NoAtomicExpression — Java
Expressions must consist of more than one piece
NoShortCircuit — Java
&& and || always evaluate both operands
ObjectsMustBeNamed — Java
A variable is needed to instantiate an object
OutsideInMethodNesting — Java
Nested method calls are invoked outside in
ParenthesesOnlyIfArgument — Java
() are optional for method calls without arguments
RightToLeftChaining — Java
Chained accesses are invoked from right to left
StringPlusStringifiesExpression — Java
String concatenation stringifies non-String operand expressions
TargetTyping — Java
The type of a numerical expression depends on the type expected by the surrounding context
ThisNoExpression — Java
The name this is not an expression
VariablesHoldExpressions — Java
= stores an expression in a variable
ArrowFunctionNoImpliedReturn — JavaScript
Even when an arrow function consists just of an expression, the return keyword must be explicitly written
ArrowFunctionRequiresFunctionKeyword — JavaScript
Arrow functions also require the keyword 'function'
ConditionalOperatorNotExpression — JavaScript
The conditional operator is not an expression
IdentifierAsStringInBracketNotation — JavaScript
An identifier used to access a property with the bracket notation is treated as a string
MandatoryAssignment — JavaScript
An expression must be assigned to have a valid statement
NoAtomicExpression — JavaScript
Expressions must consist of more than one piece
NoFunctionCallsChaining — JavaScript
It is not allowed to chain function calls
AssignCompares — Python
= compares two values
CannotChainAttributeAccesses — Python
Attribute accesses cannot be chained together
CannotChainAttributeToObjectInstantiation — Python
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.
ComparisonWithBoolLiteral — Python
To test whether an expression is True or False, one must compare it to True or to False
MapToBooleanWithTernaryOperator — Python
To map a boolean expression to a bool, a ternary conditional operator is necessary
NoAtomicExpression — Python
Expressions must consist of more than one piece
NoShortCircuit — Python
and/or always evaluate both operands
NoSingleLogicAnd — Python
& is only a bitwise AND
ObjectsMustBeNamed — Python
A variable is needed to instantiate an object
OutsideInFunctionNesting — Python
Nested function calls are invoked outside in
ParenthesesOnlyIfArgument — Python
() are optional for function calls without arguments
PlusConcatenatesNumbers — Python
The plus operator can concatenate strings and numbers
RightToLeftChaining — Python
Chained accesses are invoked from right to left
SelfNoExpression — Python
The name self is not an expression
StringLiteralNoObject — Python
One needs to call str to instantiate a str object from a string literal
VariablesHoldExpressions — Python
= stores an expression: it stores a reference to the expression in a variable
CompareBooleanToConstant — Scratch
To test whether an expression evaluates to true or false, one must compare it to a constant
EqualityOperatorComparesListIdentities — Scratch
(list a) = (list b) compares the identities of list a and list b
ExpressionAssigns — Scratch
An expression that reads a variable also updates its value after the evaluation