mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 05:42:56 +00:00
17 lines
907 B
Markdown
17 lines
907 B
Markdown
|
# Conventions
|
||
|
|
||
|
This document will list conventions that this repo should follow. These are guidelines and if you believe that one should not be followed, then please state why in your PR. If you believe that a piece of code does not follow one of the conventions listed, then please open an issue before making any changes.
|
||
|
|
||
|
When submitting a new convention, please open an issue for discussion, if possible please highlight parts in the code where this convention could help the code readiblity or simplicity.
|
||
|
|
||
|
|
||
|
## Avoid Named return paramters
|
||
|
|
||
|
|
||
|
func example(test int) (num int) {
|
||
|
a = test + 1
|
||
|
num = a * test
|
||
|
return
|
||
|
}
|
||
|
|
||
|
In the above function we have used a named return paramter, which allows you to include a simple return statement without the variables you are returning. This practice can cause confusion when functions become large or the logic becomes complex, so these should be avoided.
|