Lately I've started learning Nim (formerly Nimrod) - its a pretty neat language. I have found that there is less information about using it on the web than other languages that are more popular, so wanted to write a post on getting started with the language.
Downloading and installing
These easiest way is using this neat tool called choosenim.
curl https://nim-lang.org/choosenim/init.sh -sSf | sh choosenim stable nim -v
should give you something like:
Nim Compiler Version 0.18.0 [MacOSX: amd64] Copyright (c) 2006-2018 by Andreas Rumpf git hash: 855956bf617f68ac0be3717329e9e1181e5dc0c6 active boot switches: -d:release
In addition to installing the nim compiler, it also installs other useful tools such as nimble - the package manager.
I mainly code in vim but have found the main vim plugin somewhat lacking. On the other side of the spectrum, Visual Studio Code has a pretty fantastic nim plugin that I use. You can read more about the editor support here.
The two tutorials are a great place to start:
After those, these external examples were helpful for me:
- Nim by Example - a high level tour of syntax
- Learn Nim in Y Minutes - also high level, but has a nice spread of examples
- How I start. Nim with With Dennis Felsing - really fabulous blog post on an end to end interpreter for brainfuck (the language). Shows how to make binaries and packages and is a bit more of an end-to-end examples in Nim.
- File Handling in Nim by Peter Merholz - I found this useful when I started digging into standard i/o in Nim.