-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Tips and tricks
Hans Raaf edited this page Feb 5, 2015
·
24 revisions
- Use "nim check myfile.nim" to check your program for errors, without code generation. This makes the process quicker.
You can use the slanted quote string syntax if you need to use a reserved word as an identifier: var `type`: int
when defined(useSomeFeature):
const someSubFeature = true
type ID_Type = int32
var defaultUserName = "Frank"
else:
type ID_Type = int16
var defaultUserName = "Molly"
# `when` does not open a new scope, so `ID_Type` and `defaultUserName`
# are available here.
when isMainModule:
#this code is ran only when this module is the main compilation module
echo "This module was compiled on ", CompileDate, " at ", CompileTime
- Do it when you compile:
$ nim c -d:useSomeFeature myApp
- Put it in the local
nim.cfg
filedefine:useSomeFeature
You can use debugEcho
for this.
Intro
Getting Started
- Install
- Docs
- Curated Packages
- Editor Support
- Unofficial FAQ
- Nim for C programmers
- Nim for Python programmers
- Nim for TypeScript programmers
- Nim for D programmers
- Nim for Java programmers
- Nim for Haskell programmers
Developing
- Build
- Contribute
- Creating a release
- Compiler module reference
- Consts defined by the compiler
- Debugging the compiler
- GitHub Actions/Travis CI/Circle CI/Appveyor
- GitLab CI setup
- Standard library and the JavaScript backend
Misc