Skip to main content

Syntax Basics

Duckstruct syntax is expression-oriented and keeps declarations lightweight.

Variables

let x = 1
let greeting = "hello"

Functions

f add(a, b) {
a + b
}

Object access

let point = { x: 3, y: 4 }
point.x

Conditionals

if x > 0 {
"positive"
} else {
"not positive"
}

Loops

for item in items {
item
}