Appendix A: Keyword Reference

This appendix lists every reserved keyword in VibeLang, grouped by category. Each entry includes syntax, a brief description, a minimal example, and a chapter reference. Reserved keywords cannot be used as identifiers.


A.1 Declaration Keywords

pub

Marks a declaration as publicly visible outside its module. Without pub, declarations are module-private.

VibeLang
pub greet(name: Str) -> Str {
  "Hello, " + name
}

Chapter: 10 — Modules and Packages

type

Declares a named structured type (record).

VibeLang
pub type Point { x: Float, y: Float }

Chapter: 4 — Types and Functions

mut

Declares a mutable binding. Without mut, all bindings are immutable.

VibeLang
mut counter := 0
counter = counter + 1

Chapter: 3 — Core Syntax and Semantics

const

Declares a compile-time constant. The value must be a literal or constant expression.

VibeLang
const MAX_RETRIES := 5

Chapter: 3 — Core Syntax and Semantics


A.2 Control Flow Keywords

if / else

Conditional branching. if is an expression — it produces a value. The condition must be Bool.

VibeLang
status := if score >= 90 { "pass" } else { "fail" }

Chapter: 5 — Control Flow

for / in

Iterates over elements of a collection or range. in separates the loop variable from the iterable.

VibeLang
for name in names {
  println(name)
}

Chapter: 5 — Control Flow

while

Loops while a boolean condition remains true.

VibeLang
mut n := 10
while n > 0 {
  n = n - 1
}

Chapter: 5 — Control Flow

repeat

Executes a block a fixed number of times.

VibeLang
repeat 3 {
  println("hello")
}

Chapter: 5 — Control Flow

match

Pattern matching expression. Matches a value against patterns and executes the corresponding branch. Must be exhaustive.

VibeLang
message := match status {
  200 => "OK"
  404 => "Not Found"
  _ => "Unknown"
}

Chapter: 5 — Control Flow

case

Introduces a branch inside a select statement.

VibeLang
select {
  case msg := <-ch => println(msg)
  case after 5000 => println("timeout")
}

Chapter: 11 — Concurrency

return

Exits the current function early with a value. Optional when the function body ends with a tail expression.

VibeLang
pub abs(n: Int) -> Int {
  if n < 0 { return -n }
  n
}

Chapter: 4 — Types and Functions

break

Exits the innermost enclosing loop immediately.

VibeLang
for item in items {
  if item == target { break }
}

Chapter: 5 — Control Flow

continue

Skips the rest of the current loop iteration and proceeds to the next one.

VibeLang
for n in 0..10 {
  if n % 2 == 0 { continue }
  println(n.to_str())
}

Chapter: 5 — Control Flow


A.3 Concurrency Keywords

go

Spawns a new lightweight task that runs concurrently. Requires @effect concurrency.

VibeLang
go process_request(req)

Chapter: 11 — Concurrency

chan

Creates a typed channel for inter-task communication.

VibeLang
ch := chan(10)
ch <- "hello"
msg := <-ch

Chapter: 11 — Concurrency

select

Waits on multiple channel operations simultaneously. Executes the first branch that becomes ready.

VibeLang
select {
  case val := <-data_ch => handle(val)
  case err := <-err_ch => report(err)
}

Chapter: 11 — Concurrency

after

Timeout branch inside select. Fires after the specified milliseconds if no other case is ready.

VibeLang
select {
  case msg := <-ch => println(msg)
  case after 5000 => println("timed out")
}

Chapter: 11 — Concurrency

closed

Channel-closed branch inside select. Fires when the specified channel has been closed by the sender.

VibeLang
select {
  case val := <-ch => process(val)
  case closed ch => println("done")
}

Chapter: 11 — Concurrency

default

Non-blocking fallback in select. Executes immediately if no other case is ready.

VibeLang
select {
  case msg := <-ch => println(msg)
  case default => println("nothing ready")
}

Chapter: 11 — Concurrency

async / await

async declares an asynchronous function. await suspends execution until the awaited operation completes. await is only valid inside async functions.

VibeLang
pub async fetch_page(url: Str) -> Result<Str, Error> {
  @effect net
  response := await http_get(url)
  response.body()
}

Chapter: 11 — Concurrency

thread

Spawns an OS-level thread for CPU-bound or blocking work that should not occupy the lightweight task scheduler.

VibeLang
handle := thread compute_heavy_result(data)
result := handle.join()

Chapter: 11 — Concurrency


A.4 Literal Keywords

true / false

Boolean literals. Type is Bool.

VibeLang
enabled := true
done := false

Chapter: 3 — Core Syntax and Semantics

none

Represents the absence of a value in an optional type (T?).

VibeLang
pub find(items: List<Str>, target: Str) -> Str? {
  for item in items {
    if item == target { return item }
  }
  none
}

Chapter: 8 — Error Handling with Result


A.5 Module Keywords

module

Declares the module that the current file belongs to. Must appear at the top of the file.

VibeLang
module app.services.auth

Chapter: 10 — Modules and Packages

import

Brings declarations from another module into scope.

VibeLang
import std.io
import std.json

Chapter: 10 — Modules and Packages


A.6 Quick Reference Table

KeywordCategoryPurpose
pubDeclarationPublic visibility modifier
typeDeclarationStructured type definition
mutDeclarationMutable binding modifier
constDeclarationCompile-time constant
ifControlConditional expression
elseControlAlternative branch
forControlCollection/range iteration
inControlLoop variable separator
whileControlCondition-based loop
repeatControlFixed-count loop
matchControlPattern matching expression
caseControlBranch in select
returnControlEarly function exit
breakControlExit innermost loop
continueControlSkip to next iteration
goConcurrencySpawn lightweight task
chanConcurrencyCreate typed channel
selectConcurrencyMultiplex channel operations
afterConcurrencyTimeout branch in select
closedConcurrencyChannel-closed branch in select
defaultConcurrencyNon-blocking fallback in select
asyncConcurrencyAsynchronous function declaration
awaitConcurrencySuspend until async operation completes
threadConcurrencySpawn OS-level thread
trueLiteralBoolean true
falseLiteralBoolean false
noneLiteralAbsent optional value
moduleModuleFile module declaration
importModuleBring external declarations into scope