Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Korrin guide

A hands-on introduction. Read it front to back once; keep the specification open afterwards as a reference.

Every code block below is run by CI, so what you see is what Korrin does.

  1. Getting started — install, run a file, use the REPL.
  2. Values — numbers, strings, booleans, nil, lists, maps.
  3. Control flow and functions — if, loops, fn, closures.
  4. Classes — objects, methods, inheritance, super.
  5. Errors — try, except, finally, raise.
  6. Modules — import, module objects, the standard library.
  7. A worked example — a small program, start to finish.

The whole language on one page

  • Blocks are indentation; a newline ends a statement. No braces, no semicolons.
  • 25 keywords: and as break class continue elif else except false finally fn for if import in nil not or pass raise return super true try while.
  • # starts a comment.
  • Assignment is bare: x = 1. No let.
  • Every string interpolates: "hi {name}"; {{ is a literal brace.
  • Operations on str / list / map are methods: xs.push(v), text.trim(), m.keys(), x.len(). print, str, int, range, … stay functions.
  • Only nil and false are falsy.
  • Errors are exceptions: raise Error("..."), try: / except err: / finally:. Built-in faults are catchable and carry .code / .message.
  • import "./file" for your own modules, import "math" for the standard library; members are mod.name, _name is private.
  • / always gives a float; integer overflow is an error, not a wraparound.