01 · Program skeleton
Goal
Create, check, and run a Xu program that prints a greeting and exits successfully.
Prerequisites
Install your selected Xu SDK using the installation guide and put its xu command on PATH. Verify it in your terminal:
xu --version
You only need an empty working directory and a text editor. The complete source is below.
Steps
1. Create the source file
Create and enter an empty directory:
mkdir xu-tut01
cd xu-tut01
Save the following complete program as main.xu in that directory:
@main
fn main() int {
println("Hello, Xu!!!!!!!!!")
<< 0
}
@main marks the executable entrypoint. println prints a line, and << 0 returns a successful exit status from main. Xu uses << for return statements and does not require semicolons.
2. Check and run
In the same directory, check the file first. If the check succeeds, run it:
xu check main.xu
xu run main.xu
Expected output
xu run main.xu prints exactly this line followed by a newline and exits with status 0:
Hello, Xu!!!!!!!!!
Next
Continue to 02 · Bindings and constants.