Skip to content

Commit

Permalink
add a sample function that can serve as reference for code to follow …
Browse files Browse the repository at this point in the history
…(adapted from #8315 (comment))
  • Loading branch information
timotheecour committed Jul 14, 2018
1 parent b18ed0e commit b370902
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ proc absolutePath*(path: string, root = getCurrentDir()): string =
TODO

## code
Here's a sample code that can serve as reference:
```nim
proc myStringify(a: int) : string =
## Stringifies ``a``.
##
## On Windows, follows this [spec](https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory).
##
## **Warning:** may call ``mod.funName`` depending on ``a``.
runnableExamples:
doAssert foo(0) == "0"
result = $(a)
```
* we use double backticks (bolds text in RST) as ooposed to single backticks (italicizes it)

### prefer `proc` > `template` > `macro` when possible
As general rule of thumb, a `proc` should be preferred over a `template`, and a `template` should be preferred over a `macro` whenever possible (use the simplest tool for the job).
Expand Down

0 comments on commit b370902

Please sign in to comment.