Expressions and Operators
An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.
-
An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.
-
Expressions can be joined to one another with operators to create compound expressions.
-
Use the safe navigation operator (
?.) to replace explicit, sequential checks for null references. This operator short-circuits expressions that attempt to operate on a null value and returns null instead of throwing a NullPointerException. -
The
??operator returns its right-hand side operand when its left-hand side operand is null. Similar to the safe navigation operator (?.), the null coalescing operator (??) replaces verbose and explicit checks for null references in code. -
Operators are interpreted in order, according to rules.
-
Both single and multiline comments are supported in Apex code.
See Also