|
Oktatás
* Programozás 1 + feladatsor + GitHub oldal
* Szkriptnyelvek + feladatsor + quick link
Teaching
* Programming 1 (BI) ◇ exercises ◇ quick link
teaching assets
Félévek
* 2025/26/2 * archívum
Linkek
* kalendárium * tételsorok * jegyzetek * szakdolgozat / PhD * ösztöndíjak * certificates * C lang. * C# * D lang. * Java * Nim * Nim2 + exercises * XC=BASIC * old ◇C++, ◇Clojure, ◇Scala
[ edit | logout ] [ sandbox | passwd ]
|
#############################
I used Nim in 2018. Here are my old notes. I even solved Advent of Code 2018 in Nim (GitHub link). Unfortunately, I stoppped using Nim after that. Now, in 2026, I decided to use it again. Since I forgot most of it, I'll have to re-learn the language. I will collect my new (and hopefully improved) notes here.
These notes are for people who already know a programming language. This is not an introduction to programming with Nim. I compare Nim to mainly Python and sometimes to C in these notes.
I set up an issue tracker for these notes ⚠️
𝥶,↔, →, ←, ⤷, ⇨, ⇒, —
---
Links
---
Notes
---
Nim Basics
- indentation
- comments
- basic types + type info, type suffixes
- variables
- print to stdout
- increment a variable (
n += 1) + pass by reference
- type conversions
- math
- characters
- strings
- concatenation
- string formatting (string interpolation:
&"…", .format())
- normal, raw, multiline
- Mutable or immutable? + stringbuffer
- how an immutable string differs from Python
- for loop on an ASCII string (access characters)
- slicing an ASCII text
- reverse a string (Python:
s[::-1]) + length of Unicode strings
- converting a text (toLowercase, toUppercase)
- repeat a string
- common string methods (find, toLowerAscii, toUpperAscii, toLower, toUpper, startsWith, endsWith, replace, split, join)
strip() + lstrip(), rstrip()
- case insensitive identifier (variable/procedure) names
- stropping (use a keyword as a variable name)
- logical operators
- control structures
- procedures and functions
- parameter passing
- terminology + pass by value, shadowing, pass by reference
- read from the standard input
- tests
- sizeof
- range object (
1..100)
- types
- user-defined types: objects, tuples, enums
- type definition (give a more readable name to an existing type; C:
typedef)
- subrange types (Natural, Positive, Negative, etc.) + range object vs range type
- enums
- ⇨ tuples (see also)
- ⇨ objects (see also)
- write and use your own module
- static arrays
- sequences (dynamic array) [Python: list]
- sets
- tuples
- objects (C: structs/records; Python: classes)
- operators
- iterators
- file handling
- exception handling
- OS interface
- random numbers
- dates and times
- json
- colors
- sorting
- regexp (
std/re)
- simple examples
- ⇨ extract links from a webpage #2 (with regular expressions)
Intermediate / Advanced Topics
- preferred order (func → proc → template → macro)
- generics
- iterators
- templates
- Nim ↔ Python interaction
- working with BigInts
- pragmas
- web-related stuff
|
Blogjaim, hobbi projektjeim
* The Ubuntu Incident * Python Adventures * @GitHub * heroku * extra * haladó Python * YouTube listák
Debrecen | la France
[ edit ]
|