Migrated from tips-and-tricks v2
This commit is contained in:
parent
5ff50c5bca
commit
16d6d7ba94
|
@ -0,0 +1,17 @@
|
||||||
|
* Use the implicit "result" variable and try to avoid "return".
|
||||||
|
* Do not use templates/macros when an inline proc suffices.
|
||||||
|
* Do not use "nil" for strings and sequences. The procs of the standard library which misuse "nil" as an error value will be deprecated.
|
||||||
|
* Use "nimrod check myfile.nim" to check your program for errors, without code generation. This makes the process quicker.
|
||||||
|
|
||||||
|
h1. Using reserved words as identifiers
|
||||||
|
* You can use the slanted quote string syntax if you need to use a reserved word as an identifier: <code>var `type`: int</code>
|
||||||
|
|
||||||
|
h1. Tricks with conditional compilation
|
||||||
|
<pre>
|
||||||
|
const someFeature = True
|
||||||
|
|
||||||
|
when someFeature:
|
||||||
|
const someSubFeature = true
|
||||||
|
else:
|
||||||
|
const someSubFeature = false
|
||||||
|
</pre>
|
Loading…
Reference in New Issue