doc: mention present tense convention, explain long comments (#7036)

pull/7052/head
Larpon 2020-11-30 18:49:57 +01:00 committed by GitHub
parent b11d285680
commit 0c72c9d2f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -2496,6 +2496,19 @@ fn clearall() {
The comment must start with the name of the definition.
Sometimes one line isn't enough to explain what a function does, in that case comments should
span to the documented function using single line comments:
```v
// copy_all recursively copies all elements of the array by their value,
// if `dupes` is false all duplicate values are eliminated in the process.
fn copy_all(dupes bool) {
// ...
}
```
By convention it is preferred that comments are written in *present tense*.
An overview of the module must be placed in the first comment right after the module's name.
To generate documentation use vdoc, for example `v doc net.http`.