Learn

Each is built around a program that was compiled and run; the output shown is what it printed.

Start

Classes and lambdas

use Collection;

class Shape {
  method : virtual : public : Area() ~ Float;
}

class Circle from Shape {
  @r : Float;
  New(r : Float) { Parent(); @r := r; }
  method : public : Area() ~ Float { return Float->Pi() * @r * @r; }
}

class Square from Shape {
  @s : Float;
  New(s : Float) { Parent(); @s := s; }
  method : public : Area() ~ Float { return @s * @s; }
}

class Main {
  function : Main(args : String[]) ~ Nil {
    shapes := Vector->New()<Shape>;
    shapes->AddBack(Circle->New(1.5));
    shapes->AddBack(Square->New(2.0));
    each(i : shapes) {
      area := shapes->Get(i)->Area();
      "{$area:.2}"->PrintLine();
    };
  }
}
$ obc -src shapes.obs
$ obr shapes.obe
7.07
4.00
use Collection;

class Main {
  function : Main(args : String[]) ~ Nil {
    words := Vector->New()<String>;
    words->AddBack("compiler");
    words->AddBack("jit");
    words->AddBack("collector");

    lengths := words->Map(\(String) ~ IntRef : (w) => IntRef->New(w->Size()));
    each(i : words) {
      "{$(words->Get(i))}: {$(lengths->Get(i)->Get())}"->PrintLine();
    };

    triple := \(Int) ~ Int : (x) => x * 3;
    triple(14)->PrintLine();
  }
}
$ obc -src lambdas.obs
$ obr lambdas.obe
compiler: 8
jit: 3
collector: 9
42

Guides

GuideTopic
Query.StructuredSQL over typed tables
HTTPServer, client, connection reuse
JSON, XML, RegExParsing and bad input
CollectionsHash, Map, Vector, Set, MultiHash
Game AIMinimax, Monte Carlo tree search
EditorsLanguage server, debugger
What is new in v2026.10.3Upgrading

AI and ML

Reference

Inside

More