Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Comments

Both single and multiline comments are supported in Apex code.

We recommend using the standardized ApexDoc comment format to increase code readability, collaboration, and long-term maintainability. For the full specifications, see Document Your Apex Code.

Tip

  • To create a single line comment, use //. All characters on the same line to the right of the // are ignored by the parser. For example:
    1Integer i = 1; // This comment is ignored by the parser
  • To create a multiline comment, use /* and */ to demarcate the beginning and end of the comment block. For example:
    1Integer i = 1; /* This comment can wrap over multiple
    2                  lines without getting interpreted by the 
    3                  parser. */