The Main Entry Point
Every binary executable package must define a Main function with no parameters. By default, this file is called Main.rux. The returned int becomes the process exit code; by convention 0 means success.
// Entry point
func Main() -> int {
return 0;
}
A non-zero return value signals failure, following the usual operating-system convention. Only a binary executable package needs a Main; a library package has none.
See Also
- Function Declaration — defining functions in general
- Package Types — executable vs. library packages
- Fatal Errors — aborting with a non-zero exit code
Assembler
An asm func replaces the usual Rux body with a sequence of x86-64 instructions written by hand in Intel syntax (the destination operand comes first). Reach for one only when you need exact control over the emitted machine code — a system-call stub, a CPU-feature probe, or a routine the language cannot otherwise express — and are prepared to manage registers, the stack, and the calling convention yourself. The body is assembled straight to machine code, bypassing the normal compilation pipeline.
Overview
A struct groups related values into a single named type. Each field has a name and a type, and the struct is a value type — assigning it or passing it to a function copies the whole value, unless you take a pointer to it.