DEV Community

Cover image for Hello World In NimLang
Ahmed Muhammed Galadima
Ahmed Muhammed Galadima

Posted on

Hello World In NimLang

nim is a statically typed systems programming language that can compile to C,C++ and even JavaScript! thus nim can be used for either frontend development, back-end development and embedded development.


Getting started with nim

to get started all you need is the nim compiler which you can install at download-nim

To check if you have nim installed just run in a terminal

$ nim --version
Enter fullscreen mode Exit fullscreen mode

this should output the compiler version and a few other stuffs.

Writing some Nim

to get started all you need is a file that ends with the *.nim* extension

hello world in nim

put this in your .nim file

echo "hello world"
Enter fullscreen mode Exit fullscreen mode

now you need to compile and run your program, which can be easily done by doing

nim compile --run filename.nim
Enter fullscreen mode Exit fullscreen mode

the compile command will compile and leave an executable binary file for you. but the --run will immediately run the code for you!.

and there!, you've written your first line of code in Nim and you shouldn't stop there.. the nim website has a very well built tutorial that can get any new or seasoned developer up and running with the nim language so go try it out now!. πŸ˜„

Top comments (0)