Development · Evolving reference
Functions
Named operations and explicit signatures.
Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →
Declaration
fn Add(A: i32, B: i32) -> i32 {
return A + B;
}A function begins with fn. Parameter names precede types, and the result type follows ->. Omitting the result type means void.
Expression bodies
fn Square(X: f32) -> f32 => X * X;An arrow body directly produces the expression's value for a non-void function.
Reference parameters
fn Inspect(Value: File&) { }
fn Update(Value: mut File&) { }These fragments assume a File declaration. Reference access is read-only unless the type explicitly grants mut access.
Callable types
fn(i32) -> i32 describes a function value. ABI-qualified callable forms are a separate interoperability contract. An optional callable uses the ordinary optional type form; a callable address does not itself imply source-level nullability.
Documentation snapshot: October 24, 2026 About versions ↗