Description #
Nim is a statically typed, compiled programming language that blends the speed and control of C with the readability of Python. It’s designed for performance, expressiveness, and safety, making it ideal for systems programming, web development, and game engines.
History #
Nim was created by Andreas Rumpf in 2008 (initially called “Nimrod”) to offer a modern alternative to languages like C and Python. It matured over time with a strong open-source community and officially reached version 1.0 in 2019. Nim compiles to C, C++, or JavaScript.
Hello World Code #
echo "Hello, World!"
How to Run #
Option 1: Online
Option 2: Local
Download Nim from nim-lang.org
Save the code in a file hello.nim
:
echo "Hello, World!"
Compile and run:
nim compile --run hello.nim
Key Concepts #
- Statically typed with type inference
- Python-like syntax
- Compiles to C, C++, or JavaScript
- Zero-cost abstractions
- Meta-programming via macros
- Memory-safe and efficient
- Small standard library
- Cross-platform support
- Suitable for high-performance apps
- Interoperable with C libraries
Try It Online #
Fun Facts #
- Nim’s compiler is itself written in Nim.
- Despite Python-like syntax, Nim performs close to C in benchmarks.
- Nim can target multiple backends (C, JS, WASM) from a single codebase.