Operator

An operator is a symbol or keyword in source code that represents a built-in function.

Related concepts:  Function

Closest Wikipedia entry:  Operator (computer programming) — In computer programming, operators are constructs defined within programming languages which behave generally like functions, but which differ syntactically or semantically. Common simple examples include arithmetic (e.g. addition with +), comparison (e.g. "greater than" with >), and logical operations (e.g. AND, also written && in some languages). More involved examples include assignment (usually = or :=), field access in a record or object (usually .), and the scope resolution operator (often :: or .).

Misconceptions about Operator
28 documented Misconceptions

Check Yourself
Misconception
ArithmeticPlusPrecedesJava
Addition has higher precedence than string concatenation
Misconception
ArrayAccessWithParenthesesJava
Parenthesis are used to access an element in an array
Misconception
AssignComparesJava
= compares two values
Misconception
AssignComparesPython
= compares two values
Misconception
AssignmentNotExpressionJava
An assignment a=b is not an expression
Misconception
CannotChainAttributeToObjectInstantiationPython
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.
Misconception
CannotChainMemberAccessesJava
Member accesses cannot be chained together
Misconception
CannotChainMemberToConstructorJava
Method calls or field accesses cannot be chained to a constructor invocation
Misconception
CompareBooleanToConstantScratch
To test whether an expression evaluates to true or false, one must compare it to a constant
Misconception
ComparisonWithBoolLiteralPython
To test whether an expression is True or False, one must compare it to True or to False
Misconception
ComparisonWithBooleanLiteralJava
To test whether an expression is true or false, one must compare it to true or to false
Misconception
ConditionalOperatorNotExpressionJavaScript
The conditional operator is not an expression
Misconception
EqualityOperatorComparesObjectsValuesJava
o==p compares the objects referred to by variables o and p
Misconception
EqualityOperatorComparesObjectsValuesJavaScript
The equality operator compares two objects' values
Misconception
EqualityOperatorComparesOnlyTypesJavaScript
The equality operator '==' compares only the types of the operands
Misconception
EqualityOperatorComparesOnlyTypesScratch
() = () compares only the types of its operands
Misconception
MapToBooleanWithConditionalOperatorJava
To map a boolean expression to a boolean, a conditional operator is necessary
Misconception
MapToBooleanWithTernaryOperatorPython
To map a boolean expression to a bool, a ternary 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
NoShortCircuitJava
&& and || always evaluate both operands
Misconception
NoShortCircuitPython
and/or always evaluate both operands
Misconception
NoSingleLogicAndJava
& is only a bitwise AND
Misconception
PlusConcatenatesNumbersPython
The plus operator can concatenate strings and numbers
Misconception
PreIncrementBeforeLoopJava
Pre-increment in update part of for loop means increment before loop body
Misconception
RightToLeftChainingJava
Chained accesses are invoked from right to left
Misconception
StringPlusStringifiesExpressionJava
String concatenation stringifies non-String operand expressions

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.