nim-wiki/Tips-and-tricks.md

20 lines
534 B
Markdown
Raw Normal View History

2013-01-24 17:03:20 +00:00
* Use "nimrod check myfile.nim" to check your program for errors, without code generation. This makes the process quicker.
2013-01-25 21:18:55 +00:00
## Using reserved words as identifiers
2013-01-24 17:03:20 +00:00
2013-01-25 21:18:55 +00:00
You can use the slanted quote string syntax if you need to use a reserved word as an identifier: ``var `type`: int``
2010-09-14 10:11:11 +00:00
2013-01-25 21:18:55 +00:00
## Tricks with conditional compilation
2010-09-14 10:11:15 +00:00
2013-01-25 21:17:45 +00:00
```nimrod
2010-09-14 10:11:11 +00:00
const someFeature = True
when someFeature:
const someSubFeature = true
else:
const someSubFeature = false
2013-01-25 21:17:45 +00:00
```
2013-01-25 21:18:55 +00:00
## How do I echo in a ``{.noSideEffects.}`` proc?
2013-01-25 21:17:45 +00:00
You can use ``debugEcho`` for this.