Code Samples

When introducing large amounts of code, avoid naming the type of code if possible. For example, don't introduce a code sample written in Java as this Java or the following Java. When you can't avoid using a term to introduce a code sample, use the following terms, depending on what the sample is:
  • Apex script
  • Apex class
  • Apex trigger
  • Visualforce markup

You can also specify the language in a heading, such as Java Sample or C# Sample. Use this in a reference guide when you are presenting more than one version of a program, class, or method.

Using XML or HTML is acceptable in the context of The following HTML contains Visualforce markup.

Use three spaces when indenting code samples when possible. Two spaces may be necessary to conserve space or four spaces to be consistent with Sun, Java, and IDE conventions. Spaces must be consistent within a sample and across a topic.