Development · Evolving reference
Optional values
A value, or an explicit absence.
Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →
Optional type
pub fn Adjust(Value: i32) -> i32? {
if Value < 0 {
return none;
}
return Value + 1;
}T? denotes an optional value. none represents absence. This example comes from the authored language acceptance fixtures.
Access and representation
Optionality is independent of reference or pointer access qualification. A writable access path cannot be created by wrapping or unwrapping an optional.
Handle absence deliberately
Pattern matching and version-specific optional operations distinguish a present value from absence. Do not assume a callable is nullable merely because it has an address at the machine level.
Documentation snapshot: October 24, 2026 About versions ↗