1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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

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`.