Newer Version Available

This content describes an older version of this product. View Latest

Assignment Statements

An assignment statement is any statement that places a value into a variable.
An assignment statement generally takes one of two forms:
In the forms above, [LValue] stands for any expression that can be placed on the left side of an assignment operator. These include:
  • A simple variable. For example:
  • A de-referenced list element. For example:
  • An sObject field reference that the context user has permission to edit. For example:
Assignment is always done by reference. For example:
Similarly, two lists can point at the same value in memory. For example:

In addition to =, other valid assignment operators include +=, *=, /=, |=, &=, ++, and --. See Expression Operators.