Simple Guide

Fast Like C.
Easy Like Python.

Imagine writing code as easily as reading a basic book, but it runs as fast as a race car. That is Nim.

import times
proc greetTheWorld() =
echo "Hello! I am very fast."
greetTheWorld()

The Big Choice (And Why You Don't Have To Make It)

Easy but Slow

Some languages use simple words. They are great for beginners. But when you try to run them, they move like a turtle. Your computer has to work hard to read them.

Fast but Hard

Other languages (like C or C++) are super fast. But they are full of strange symbols and math. It takes years to write them without making mistakes.

The Winner

Nim: Easy and Fast

Nim gives you both. You type simple words. But the computer runs it at top speed. You get the best of both worlds with no extra effort.

How Nim Works: The Translation Trick

How does Nim run so fast if the words are so simple? It uses a clever trick. Nim does not run your code directly. Instead, it acts like an expert translator.

Step 1

You Write Simple Code

You type easy, clean Nim words.

Step 2

Nim Translates It

Nim quietly rewrites your words into super-fast C code.

Step 3

Lightning Fast App

The computer packs it into a ready-to-run file.

Clean Words, No Clutter

Many languages use strange symbols like curly brackets {} and semicolons ; at the end of every line. Nim removes the clutter. It uses spaces to organize code, making it beautiful to read.

Older Languages (Cluttered)
void sayHello() {
  if (user == "admin") {
    printf("Welcome!");
  }
}
Nim (Clean)
proc sayHello() =
  if user == "admin":
    echo "Welcome!"

Just One File to Share

When you finish writing Nim, it builds a "Native Binary".

What does that mean? It means your entire program is packed into one single, neat file.

  • You do not need to install extra software to run it.
  • You can email the file to a friend, and they can just click it.
  • It starts instantly because the computer already understands it.
MyApp.exe READY TO RUN

Build It Your Way

Everyone thinks differently. Some people like step-by-step lists. Some like sorting things into neat boxes. Nim lets you write code in the style that makes sense to your brain.

1

Step-by-Step

You tell the computer exactly what to do in order. "First do this, then do that." This is the easiest way to start.

2

Object Boxes

You build little digital items. Like a "Car" that has "Wheels" and a "Drive" button. This is great for making games.

3

Math Rules

You build smart rules where you drop information in, and get new information out without breaking anything.

Where Can You Use Nim?

Because Nim is fast and small, you can use it to build almost anything. Here are the top three things people build with it.

Web Servers

Websites that thousands of people click on at the exact same time need code that does not crash or slow down.

Game Engines

Video games need super fast math to draw 3D pictures on the screen 60 times every second. Nim handles this easily.

Daily Tools

Need a quick script to rename 500 photos on your laptop? Nim scripts are easy to write and finish in a blink.

Invisible Memory Cleaning

When code runs, it borrows memory from your computer. When it is done, it must give the memory back. If it forgets, your computer runs out of space and crashes.

Some languages make you clean it up yourself. It is boring and easy to mess up. Other languages clean it up automatically, but they stop your program for a second to sweep the floor. This causes game lag.

Nim cleans up invisibly.

Nim uses a smart system that knows exactly when to throw away trash without ever hitting the pause button on your app.

Old Way: PAUSES APP
Manual Way: HARD TO DO
Nim Way: FAST & INVISIBLE

Meet Nimble: The Tool Bag

You do not have to build everything from scratch. Nim has a helper tool called Nimble.

Nimble is a huge bag of extra code parts built by other smart people online. If you want to build a website, you do not have to build the server yourself. You just ask Nimble for the "Web Server" part, and it plugs it right into your code.

> nimble install jester

Your First Steps

Ready to try it? It is incredibly easy to start.

A

Create a file

Open a text editor and save a file named game.nim.

echo "Ready to play!"
B

Run it

Open your terminal (the black box where you type commands) and tell Nim to compile and run your file.

> nim c -r game.nim ENTER
C

See the Magic

Nim will translate it, build it, and run it all in one second.

Ready to play!

Code That Writes Code

Sometimes writing code is boring because you have to type the same things over and over. Nim has a magic trick called "Macros".

You type 1 line
makeGameHero("Knight")
Nim creates 50 lines
hero.health = 100
hero.armor = true
hero.weapon = "Sword"
...and much more automatically!

Talking to Old Code

There are millions of lines of old, useful code written in languages like C. You do not have to rewrite them. Nim can shake hands with them and use them directly.

Nim Code

Fresh, new, and easy to read.

Old C Code

30 years old, but still works perfectly.

Running in the Web Browser

Remember how Nim translates your code into fast C code for your computer? It can do another magic trick. It can translate your code into JavaScript to run inside a web browser!

1

Write Once

You write your game or app rules just one time using Nim.

2

Run Everywhere

Tell Nim to build it for the web, and it instantly works on any website.

The Shape Sorter Box

Imagine a baby's toy box. If you try to push a square block into a round hole, the toy stops you. Nim does this with your code. It is called "Strong Typing."

Error Caught!

Let Age = 10 (This is a Number)
Age = "Hello" (This is a Word)
Nim says: STOP! Words do not fit in Number boxes.

Because Nim checks your shapes before it builds the app, it catches almost all your silly spelling or math mistakes before anyone else ever sees them.

No Waiting Around

Some languages that translate to C take a very long time. You click "Build" and have to go make a cup of coffee while you wait.

Nim translates almost instantly.

You hit save, click run, and your game pops up on the screen in a blink of an eye. It keeps you focused on your work.

Plays Nice With All Computers

You do not have to buy three different computers to make your app work for everyone. Nim works smoothly on all of them from the very start.

Windows

WORKS

Mac OS

WORKS

Linux

WORKS

Juggling Many Balls at Once

Computers today have many "brains" (called cores) inside them. If your app only uses one brain, it is wasting power. Nim makes it super easy to use all the brains at the same time.

Slow App:
Nim App:
Brain 1 Work
Brain 2 Work
Brain 3 Work

By splitting the work into three lanes, Nim finishes the job three times faster.

Typing Style Freedom

People like to name things differently. Some write my_score. Others write myScore. In older languages, if you mix them up, the code breaks.

Nim is incredibly forgiving. It ignores capital letters and underlines (except for the very first letter).

my_score
=
myScore

To Nim, these are the exact same word. You will never get an error just for spelling it in a different style.

A Friendly Village

Support

Learning a new tool is scary alone. But Nim has a small, super friendly community of builders. If you get stuck, there are forums and chat rooms where experts love to help beginners figure out their code. You do not have to be a genius to ask a question.

The Final Review

Why should you pick Nim for your next project?