Expressions and Operators
An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.
-
Expressions
An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.
-
Expression Operators
Expressions can be joined to one another with operators to create compound expressions.
-
Safe Navigation Operator
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.
-
Null Coalescing Operator
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.
-
Operator Precedence
Operators are interpreted in order, according to rules.
-
Comments
Both single and multiline comments are supported in Apex code.
See Also