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 Expression
51 documented Misconceptions

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