Hello World

Write your first Sounio program

Complete the platform setup first. Linux x86-64 uses the committed prebuilt; macOS ARM64 needs the separately built native compiler. Confirm the selected compiler’s identity before running these commands.

The complete program

This is the full, unchanged source of examples/hello.sio. The block below is Sounio code; terminal commands follow separately.

// First Sounio program

fn main() -> i32 with IO {
    println("Hello, Sounio")
    return 0
}

main is the entry point. with IO declares the input/output effect used by println. The explicit return 0 gives this program its successful exit status.

Check and run

From the repository root, after completing setup:

export SOUNIO_STDLIB_PATH="$PWD/stdlib"
./bin/souc check examples/hello.sio
./bin/souc run examples/hello.sio

Proceed to run only after check succeeds. The expected message is Hello, Sounio, with exit status zero. Record the actual output and exit status for each command. A successful check does not establish successful execution; the expected result here is not a new measurement of your environment.

To try your own variation, copy the complete program into a separate .sio file and change the message. Check and run that file, keeping the repository example unchanged.

Next: structs and fields · Programming guide