Description #
Nim is a statically typed, compiled programming language that combines the performance of C with the expressiveness of Python and the powerful metaprogramming capabilities of Lisp. It supports multiple paradigms, including functional, procedural, and object-oriented programming.
History #
Nim was created by Andreas Rumpf in 2008 under the name Nimrod and later renamed to Nim in 2014. It was designed to offer high-performance systems programming with a clean syntax and strong type safety. Nim compiles to C, C++, or JavaScript, making it versatile for many platforms.
Hello World Code #
echo "Hello, World!"
How to Run #
Option 1: Online
Option 2: Local
- Install Nim:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
Save code as hello.nim
and run:
nim compile --run hello.nim
Key Concepts #
- Statically typed with type inference
- Multi-paradigm (functional, imperative, object-oriented)
- Macro-based metaprogramming
- Compiles to C/C++/JavaScript
- High-performance native code
- Garbage collection with manual control options
- First-class functions and closures
- Immutability and pattern matching
- Strong compile-time checks
- Clean, Python-like syntax
Try It Online #
Fun Facts #
- Nim can create native GUIs, web apps, and embedded system programs.
- Despite its power, Nim’s syntax is beginner-friendly and readable.
- The compiler itself is written in Nim.