"@something" words in comments?

91 Views Asked by At

What for are these "@word" in comments?

I've seen those in JavaScript and some other languages. Is there some standards with this or is it specially for something specific tool? Can someone open this more advanced commenting process if there is more things similar to this one. And secondly why this example starts with two asterisk mark?

Example:

/**
 * Builds an absolute Path for a project, where
 * the files should be stored
 *
 * @param projectDir String
 * @param fileName String (optional)
 * @return {String} absolute Path
 */
2

There are 2 best solutions below

0
On BEST ANSWER

It may look like just aesthetic commenting with some pre-formatted conventions.

But these comments are actually used by development tools to provide automated documentation generation (like JSDoc), syntactic and type checking, or even to get compilation directives (Google Closure minifier).

Both the 2 asterisks and the @something notations are conventions for these development tools.

So if you will never use such development tools, this notation is purely aesthetic. But if you were to use these tools, then it becomes part of your workflow to leverage automated processes.

0
On

No, there is no standard, but one of the most popular tools for that style of documentation comment is JSDoc, which is loosely based on Java's JavaDoc comments.