An ordered set of instructions. It reads input, follows rules, and produces output.
Workspace
Nim
compiled scripting systems tools and expressive native programs
Definition first
What Nim means
Nim is a programming language for writing exact instructions, often used for compiled scripting systems tools and expressive native programs. Start with one mental model: input goes through steps and becomes output.
main.nimRun nim c -r main.nimHabit Keep indentation clean and start with readable proceduresA value is data. A variable is the name you use to hold and reuse that data.
A named piece of work. It takes input, does one job, and can return a result.
Nim compiler is the place that actually runs code from main.nim.
First readable code
Program output
entry point output syntax echoecho 42
Output 42Language lineage
Nim family tree
See where Nim comes from, which languages feel close, and what to learn next.
Zero base path
Question bank
Search before practice
Pick a stage or search across the open programming bank. Jump straight to the matching drill.
Nim practice 1
Nim question 1. Choose the statement that matches printing a value.
Nim practice 2
Nim question 2. Choose the statement that matches naming a value.
Nim practice 3
Nim question 3. Choose the statement that matches reusable function.
Nim practice 4
Nim question 4. Choose the statement that matches basic collection.
Nim practice 5
Nim question 5. Choose the statement that matches printing a value.
Nim practice 6
Nim question 6. Choose the statement that matches naming a value.
Nim practice 7
Nim question 7. Choose the statement that matches reusable function.
Nim practice 8
Nim question 8. Choose the statement that matches basic collection.
Nim practice 9
Nim question 9. Choose the statement that matches printing a value.
Nim practice 10
Nim question 10. Choose the statement that matches naming a value.
Nim practice 11
Nim question 11. Choose the statement that matches reusable function.
Nim practice 12
Nim question 12. Choose the statement that matches basic collection.
Nim practice 13
Nim question 13. Choose the statement that matches printing a value.
Nim practice 14
Nim question 14. Choose the statement that matches naming a value.
Nim practice 15
Nim question 15. Choose the statement that matches reusable function.
Nim practice 16
Nim question 16. Choose the statement that matches basic collection.
Nim practice 17
Nim question 17. Choose the statement that matches printing a value.
Nim practice 18
Nim question 18. Choose the statement that matches naming a value.
Multiple choice
Nim practice 1
Nim question 1. Choose the statement that matches printing a value.
echo 42
Reference
Patterns for main.nim
nim c -r main.nimentry point output syntax echo
Program output
echo 42
- Run the smallest file first
- Print one known value
- Check the output before adding more code
variables assignment types let
Values and names
let total = 42 echo total
- Give values readable names
- Keep one idea per line while learning
- Trace the value before changing it
function collection Seq
Functions and collections
proc add(a: int, b: int): int = a + b let scores = @[40, 2] echo scores.len
- Keep functions small
- Return useful values
- Use the common collection before reaching for frameworks