Tasks are Thorn's functions. Sections are Thorn's answer to code organisation — a lighter alternative to classes that does not force object-oriented patterns.
task add(x, y) {
send x + y
}
task greet(name) {
write(v"hello {name}")
}
result = add(3, 4)
greet("world")
Tasks with no send implicitly return void.
section networking {
task connect(url) { }
task disconnect() { }
}
networking.connect("pawnet://ABC12")
section.global networking { }
section.parent database { }
section(ui, main) networking { }
section main {
task run() {
write("hello")
}
}
if (start) {
main()
}
spawn(fetchData(url)) out = spawn(process(data)) write(out) # waits if needed
Copyright ©2026 Thorn Language Project. All Rights Reserved