Types

Shrimp is statically typed with type inference. Variables declared with let get their type from the initializer, or you can annotate explicitly.

Available types

TypeSizeRangeUse case
u88 bits0 โ€“ 255Positions, counters, tile indices
i88 bits-128 โ€“ 127Velocities, signed offsets
u1616 bits0 โ€“ 65535Larger values
bool8 bitstrue / falseFlags, conditions

Type inference

let x = 10          # u8 (positive integer literal)
let y = -3          # i8 (negative integer literal)
let big = 300       # u16 (value > 255)
let flag = true     # bool

Explicit annotations

let speed: i8 = 0       # force signed even though 0 is positive
let counter: u16 = 0    # force 16-bit width
let on_ground: bool = false

Overflow behavior

All arithmetic wraps on overflow, matching the Game Boy's native 8-bit behavior:

This is useful for screen wrapping โ€” a sprite that moves past x=160 will wrap around naturally.