@example Summary Provides example usage for the item being documented. Syntax @example title code Parameters title The title of the example. code Example code showing example usage of the item being documented. Description The @example tag is used for documenting example usage(s) of the item being documented. For instance, if a method is being documented, the @example tag can document how the method can be called or illustrate scenarios the method can be useful. The title of the example must occur on the same line as the @example tag. Code should always begin on the next line following the @example tag. Examples Documenting an 'add' Method 123456789101112131415class Calculator{ /** * Adds two numbers together and returns the result. * * @example Basic Usage * add(1, 1); // 2 * add(2, 2); // 4 * add(2, 3); // 5 */ int add(int x, int y) { return x + y; }} Multiple @example Tags 12345678910111213141516171819class Calculator{ /** * Adds two numbers together and returns the result. * * @example 1 + 1 * add(1, 1); // 2 * * @example 2 + 2 * add(2, 2); // 4 * * @example 2 + 3 * add(2, 3); // 5 */ int add(int x, int y) { return x + y; }} Share HTML | BBCode | Direct Link