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 Expression51 documented Misconceptions
Check YourselfAssignCompares
= compares two valuesCannotChainAttributeToObjectInstantiation
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.ComparisonWithBoolLiteral
To test whether an expression is True or False, one must compare it to True or to FalseMapToBooleanWithTernaryOperator
To map a boolean expression to a bool, a ternary conditional operator is necessaryNoAtomicExpression
Expressions must consist of more than one pieceNoShortCircuit
and/or always evaluate both operandsObjectsMustBeNamed
A variable is needed to instantiate an objectOutsideInFunctionNesting
Nested function calls are invoked outside inParenthesesOnlyIfArgument
() are optional for function calls without argumentsPlusConcatenatesNumbers
The plus operator can concatenate strings and numbersRightToLeftChaining
Chained accesses are invoked from right to leftSelfNoExpression
The name self is not an expressionVariablesHoldExpressions
= stores an expression: it stores a reference to the expression in a variable