Standard Library Tour
Core: print, arrays, maps, strings, panic, error Files, directories, env, processes, args
math, math.big, math.bits, math.complex, math.fractions, math.stats, math.vec
strings, strconv, encoding.utf8, regex, strings.textscanner
arrays, maps, datatypes (Stack, Queue, LinkedList, BSTree, Set, MinHeap) Dates, durations, stopwatch, formatting rand, rand.seed, crypto.rand
json (comptime fast), x.json2 (dynamic), toml, encoding.csv, encoding.base64, encoding.hex, encoding.xml, encoding.binary
net, net.http, net.urllib, net.websocket, net.smtp, net.mbedtls, net.openssl, net.html
veb (web framework), veb.auth, veb.csrf, veb.sse Web (vweb is the deprecated predecessor) db.sqlite, db.pg, db.mysql, orm
crypto.sha256, sha1, sha512, md5, hmac, aes, bcrypt, ed25519, blake2b, blake3 sync, sync.pool, sync.stdatomic
gg, gx, sokol, stbi, fontstash flag, cli, term, term.ui, readline io, io.util, bufio
compress.gzip, compress.zlib, compress.deflate, compress.zstd, szip
benchmark, v.* (compiler as a library: parser, ast, checker, scanner)
Experimental modules (x.json2, x.crypto, x.ttf, x.templating.dtm)
30.1 Time
import time
now := time.now()
println(now.format_ss()) // 2025-10-24 10:30:00
println(now.ymmdd())
println(now.unix())
println(now.year)
println(now.weekday_str())
later := now.add(2 * time.hour)
println(later - now) // Duration
t := time.parse('2025-10-24 10:00:00') or { panic(err) }
_ = t
mut sw := time.new_stopwatch()
time.sleep(50 * time.millisecond)
println(sw.elapsed().milliseconds())
println(now.custom_format('YYYY-MM-DD HH:mm'))30.2 Random and Math
import rand
import math
println(rand.intn(100) or { 0 }) // 0..99
println(rand.int_in_range(1, 7) or { 1 })
println(rand.f64())
println(rand.uuid_v4())
println(rand.string(8))
mut arr := [1, 2, 3, 4]
rand.shuffle(mut arr) or {}
println(rand.element(arr) or { 0 })
rand.seed([u32(42), 0])
println(math.sqrt(2))
println(math.pow(2, 10))
println(math.abs(-3))
println(math.max(3, 7))
println(math.round(2.5))
println(math.pi)
println(math.floor(3.7))
println(math.clamp(15, 0, 10))30.3 Datatypes
import datatypes
mut q := datatypes.Queue[int]{}
q.push(1)
println(q.pop() or { 0 })
mut s := datatypes.Stack[string]{}
s.push('a')
mut set := datatypes.Set[string]{}
set.add('x')
println(set.exists('x'))
mut heap := datatypes.MinHeap[int]{}
heap.insert(5)
heap.insert(1)
println(heap.pop() or { 0 })
mut ll := datatypes.LinkedList[int]{}
ll.push(1)