Nim Tutorial

Nim is a statically typed system programming language that focuses on safety and performance. It is a third generation language with features inspired from high-level languages: Python, Ada, and Lisp. It was created by a team led by Andreas Rumpf from Germany and is now ready for production projects.

Scope: Study the lessons in order, compile the examples locally, and revisit the index for targeted reference.

Nim Study Progress

0% Complete
# NIM Topic Description
PHASE 1: FOUNDATIONS
01Why Nim & Thinking in NimOrigins and purpose: expressive syntax, static safety, and C-level performance.
02Toolchain, Environment & ToolingInstall Nim, choose an editor, and compile your first program.
03Statements, Expressions & IndentationSignificant indentation, expressions everywhere, comments, and identifiers.
PHASE 2: TYPES & CONTROL
04Types & the Type SystemStatic types, inference, ranges, distinct types, and safe conversions.
05Control Flow & Iterationif, case, while, for, break and continue — every branch exhaustive.
06Procedures, Scopes & First-Class ProcsParameters, overloading, default values, closures, and proc types.
PHASE 3: DATA MODELLING
07Objects, Methods & InheritanceTuples, objects, methods, inheritance, and dynamic dispatch.
08Enums, Sets & Variant ObjectsEnums, sets, and variant objects with compile-time checked discriminators.
09Arrays, Sequences, Sets & TablesFixed arrays, seq[T], hash sets and tables, and their iteration protocols.
10Strings, Characters & FormattingString and char types, interpolation, slicing, and the strutils toolbox.
PHASE 4: ABSTRACTION & REUSE
11Generics & Type ClassesGeneric procs and types, constraints, and type classes that describe concepts.
12Modules & PackagesModules, exports, private versus public, and packages managed by Nimble.
13Iterators & ClosuresInline and closure iterators, and how a for loop is desugared.
14Templates & MacrosTemplates, macros, AST manipulation, and compile-time code generation.
PHASE 5: SAFETY & PERFORMANCE
15Errors & ExceptionsExceptions, custom error types, try/finally, defer, and Option.
16Memory Management & ARC/ORCValue versus reference semantics, ARC/ORC, and move and sink parameters.
17Concurrency, Threads & AsyncThreads, channels, async/await, and how Nim keeps races out of reach.
18C/FFI Interop & Foreign Librariesimportc, header pragmas, exporting to C, and static libraries.
PHASE 6: ENGINEERING PRACTICE
19Testing & Debuggingstd/unittest, doAssert, the debugger, and reading compiler diagnostics.
20Compilation, Build Modes & DeploymentDebug, release and danger modes, cross-compilation, and shipping binaries.
21Standard Library TourThe modules you will use daily: os, strutils, json, times, and more.
PHASE 7: PRACTICE & DEMO
22Lab ExamplesRun and modify single-file practice demos for every lesson.
23Study ProjectsA linked list, a generic stack with unit tests, and a command-line journal.
PHASE 8: REFERENCE
24References & LearningOfficial manual, playgrounds, community, exercises, and sample repositories.
Credits: Lesson content drafted with DeepSeek via Fireworks AI. References: free tutorials below.

Free References

For the full categorized table — playgrounds, the official manual, community channels, exercises and sample repositories — see the References & Learning page. Practice files live on the Lab Examples page and the Study Projects page.