19 · Documentation
Doc Tags
Tags @param, @returns, @throws, @example, @see, @since, and @deprecated in doc comments.
On this page
Doc comments accept tags that the editor formats as distinct sections in the hover: parameters, return value, possible errors, usage examples, and cross-references.
The basic tags are @param (one per parameter), @returns (output value),
and @throws (errors or sentinel values that may be returned):
@example opens an inline code block inside the doc comment — useful for
showing typical usage directly in the hover, without relying on external
documentation.
@see creates a cross-reference to another symbol. @since records the
version when the API was introduced. @deprecated signals that the function
should no longer be used and points to its replacement.
Challenge
Write a clamp(value, min, max) function with a complete doc comment using
all the tags: @param for each argument, @returns describing the behavior
at the boundaries, @example with a value that gets clamped, and
@since 0.1.0.
See also