nep1: triple quote literals should start with newline (#17065)
This commit is contained in:
parent
cd274a5ac9
commit
8162c47b0f
1 changed files with 21 additions and 0 deletions
21
doc/nep1.rst
21
doc/nep1.rst
|
|
@ -281,5 +281,26 @@ Conventions for multi-line statements and expressions
|
||||||
startProcess(nimExecutable, currentDirectory, compilerArguments
|
startProcess(nimExecutable, currentDirectory, compilerArguments
|
||||||
environment, processOptions)
|
environment, processOptions)
|
||||||
|
|
||||||
|
Miscellaneous
|
||||||
|
-------------
|
||||||
|
|
||||||
- Use `a..b` instead of `a .. b`, except when `b` contains an operator, for example `a .. -3`.
|
- Use `a..b` instead of `a .. b`, except when `b` contains an operator, for example `a .. -3`.
|
||||||
Likewise with `a..<b`, `a..^b` and other operators starting with `..`.
|
Likewise with `a..<b`, `a..^b` and other operators starting with `..`.
|
||||||
|
|
||||||
|
- Prefer triple quote literals to start with a newline; it's semantically identical
|
||||||
|
(it's a feature of triple quote literals) but clearer because it aligns with the next line:
|
||||||
|
|
||||||
|
use this:
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
let a = """
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
"""
|
||||||
|
|
||||||
|
instead of:
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
let a = """foo
|
||||||
|
bar
|
||||||
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue