Skip to content

Quick Reference

One-page cheat sheet for Q++.

Project Setup

qpp init
qpp run

Variables

make x: i32 = 42;        // Immutable
make shift y: i32 = 0;   // Mutable
y = y + 1;

Functions

craft add(a: i32, b: i32) -> i32 {
    send a + b;
}

Control Flow

check (x > 0) { ... }
otherwise { ... }

loopwhile (i < 10) { ... }
foreach item in arr { ... }
for (make i = 0; i < 10; i = i + 1) { ... }

Types

i32, u64, f64, bool, str, void
link T, [T; N], (A, B), Result(Ok, Err)

Structs and Enums

form Point { x: i32, y: i32 }
state Color { Red, Green, Blue }
state Option(T) { None, Some(T) }

Modules

bring "std.fs";
bring "std.math";
fs.open_file("x.txt", "r");

Pointers

make p: link i32 = mark x;
make v: i32 = reach p;

Unsafe

hazard {
    cblock { " raw C " };
    machine { "asm" };
}

CLI

qpp build [--release] [--emit-llvm] [--define NAME]
qpp run
qpp fmt
qpp watch
qpp check
qpp lsp