Learn YOUNA

One language.
Build anything.

Every example below is real YOUNA — the same code that runs through the interpreter, the IR evaluator and the JS compiler. Most of them even run right here in your browser: hit Run this and the playground opens with the code loaded.

Start here

YOUNA runs on Node.js ≥ 22.6 — no build step, zero dependencies. Source files end in .you.

terminal
# get the toolchain
git clone https://github.com/younasoft/youna && cd youna

# run a program
node cli/youna.ts run examples/hello.you

# scaffold your own project
node cli/youna.ts init myapp

The basics

Variables, functions, loops, string interpolation — everything reads the way you'd expect. Errors carry source positions; ?? and ! handle missing values explicitly.

basics.you
let name = "world"

function greet(who) {
    return "hello " + who
}

for i in range(1, 4) {
    print("{i}: {greet(name)}")
}

// Option types — missing values are explicit, not crashes
let port = env("PORT") ?? 8080
print("port: {port}")
Run this in the playground →

Errors & safety

try/catch/finally — and you can throw any value, including maps. Caught errors interpolate into strings like normal values.

errors.you
function withdraw(balance, amount) {
    if amount > balance {
        throw {reason: "insufficient funds", short: amount - balance}
    }
    return balance - amount
}

try {
    let left = withdraw(100, 250)
    print("left: {left}")
} catch e {
    print("{e['reason']}: short by {e['short']}")
} finally {
    print("always runs")
}
Run this in the playground →

Concurrency

spawn runs functions as background tasks, await_task/await_all collect results, and parallel for overlaps safe loop iterations automatically — the checker proves safety for you.

tasks.you
function slowDouble(n) {
    sleep(50)
    return n * 2
}

let t1 = spawn(slowDouble, 10)
let t2 = spawn(slowDouble, 20)

print(await_task(t1))   // 20
print(await_task(t2))   // 40

// collect an array of tasks, in order
function square(n) { return n * n }
print(await_all([spawn(square, 1), spawn(square, 2), spawn(square, 3)]))
Run this in the playground →

Modules

Every .you file is a module. Only exported names are visible to importers — everything else stays private. Modules run once, in their own scope.

mathlib.you + app.you
// mathlib.you
export let VERSION = "1.0"
export function square(n) { return n * n }

// app.you — named imports or a namespace
import {square, VERSION} from "./mathlib.you"
import * as math from "./mathlib.you"

print("{square(9)} v{VERSION} — {math.square(2)}")

Needs the CLI — the browser playground runs a single file with the filesystem denied.

Build a website

A real HTTP server is a builtin. Your handler is an ordinary YOUNA function — a map in, a response out. Runs on the real node:http under the hood.

server.you
permission network

function router(req) {
    let path = req["path"]
    if path == "/"        { return "hello from youna" }
    if path == "/hello"   { return {status: 200, body: "hi!"} }
    return {status: 404, body: "no such route"}
}

let server = http_serve(router, 8080)
print("listening on :{http_port(server)}")

Needs the CLI — browsers can't open listening sockets. permission network declares it upfront — declaring any permission switches the program to deny-by-default.

Use a database

SQLite is built in — db_open(":memory:") needs no server at all. Parameters are real ? binds, so injection is impossible. Rows come back as maps.

notes.you
let db = db_open(":memory:")

db_exec(db, "CREATE TABLE notes(id INTEGER PRIMARY KEY, title TEXT)")
db_run(db, "INSERT INTO notes(title) VALUES (?)", ["learn youna"])
db_run(db, "INSERT INTO notes(title) VALUES (?)", ["ship it"])

for row in db_query(db, "SELECT title FROM notes") {
    let title = row["title"]!
    print("- {title}")
}
Run this in the playground →

Draw & games

A software rasterizer is built in — lines, circles, polygon fills, pixel access — plus a full 3D pipeline with perspective and depth. Pixels are plain values: render them anywhere.

scene.you
let img = image_create(80, 50)

fill_all(img, [30, 40, 80])                          // sky
fill_circle(img, 62, 12, 8, [255, 210, 60])          // sun
fill_polygon(img, [[0, 34], [18, 14], [36, 34]], [60, 60, 90])  // mountain
fill_rect(img, 0, 34, 80, 16, [40, 90, 45])          // ground

print("drew a {image_width(img)}x{image_height(img)} scene")
Run this in the playground →

Build a blockchain

A real proof-of-work ledger is a builtin — canonical hashing, mining difficulty, tamper-evident verification, ed25519 signatures. This is the same machinery YounaCoin runs on.

ledger.you
let ledger = chain_create({network: "demo"}, 2)

chain_add(ledger, {from: "mint",  to: "alice", amount: 100})
chain_add(ledger, {from: "alice", to: "bob",   amount: 30})

print("blocks: {chain_len(ledger)}")
print("valid:  {chain_verify(ledger)}")
Run this in the playground →

AI & tensors

n-dimensional tensors with real NumPy-style broadcasting, matmul, activations, and dense model stacks — pure math that even runs inside GPU kernels.

forward.you
let w = tensor_from([[2, -1], [0, 3]])   // weights
let x = tensor_from([[1, 0], [0, 1]])   // batch
let b = tensor_from([[1, 1]])           // broadcasts over rows

// one-layer forward pass: relu(x @ W + b)
let h = tensor_relu(tensor_add(tensor_matmul(x, w), b))
print("hidden: {tensor_toarray(h)}")
print("softmax: {tensor_toarray(tensor_softmax(h))}")
Run this in the playground →

Ship to every device

One source file becomes real platform artifacts — not wrappers, real projects:

terminal
node cli/youna.ts build app.you                    # standalone JS (node + browsers)
node cli/youna.ts build --target android app.you   # Gradle project → APK
node cli/youna.ts build --target ios app.you       # Xcode project → .app
node cli/youna.ts package app.you                  # single-file .exe

Declared permissions flow into the emitted Android manifest and iOS Info.plist automatically.

Ready?

Open the playground and write your first program — or start with the docs in the repo's docs/ folder.

Open the playground YOUNA overview