Hello World

Hello World in Thorn

The simplest Thorn program, walked through in detail.


The Program

Create hello.th:

write("hello world")

Compile and run:

thorn build hello.th
./hello

Output: hello world

What's happening

write() prints any value to standard output. No semicolons. No required main() for simple scripts.

For larger programs, use section main:

section main {
    task run() {
        write("hello world")
    }
}
if (start) {
    main()
}

start is on when run directly, off when imported.