Swift: Understanding // MARK

The // MARK: and // MARK: – syntax in Swift functions identically to the #pragma mark and #pragma mark – syntax in Objective-C. When using this syntax (plus // TODO: and // FIXME:), you can get some extra information to show up in the quick jump bar. Consider these few lines of source code: // … Read more

/** and /* in Java Comments

The first form is called Javadoc. You use this when you’re writing formal APIs for your code, which are generated by the javadoc tool. For an example, the Java 7 API page uses Javadoc and was generated by that tool. Some common elements you’d see in Javadoc include: @param: this is used to indicate what … Read more

Where is the syntax for TypeScript comments documented?

Current The TypeScript team, and other TypeScript involved teams, created a TSDoc specification. https://tsdoc.org/ Example straight from the docs: export class Statistics { /** * Returns the average of two numbers. * * @remarks * This method is part of the {@link core-library#Statistics | Statistics subsystem}. * * @param x – The first input number … Read more

What is self-documenting code and can it replace well documented code? [closed]

Well, since this is about comments and code, let’s look at some actual code. Compare this typical code: float a, b, c; a=9.81; b=5; c= .5*a*(b^2); To this self-documenting code, which shows what is being done: const float gravitationalForce = 9.81; float timeInSeconds = 5; float displacement = (1 / 2) * gravitationalForce * (timeInSeconds … Read more