Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

Print

Attempts to write one complete borrowed UTF-8 view to standard output.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.io

import std.io;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

TryPrint

pub fn TryPrint(Value: str) -> Result<void, IoError>

Attempts to write one complete borrowed UTF-8 view to standard output.

On the Linux/POSIX target, a closed pipe is reported as OutputFailed; the operation contains the SIGPIPE generated by its own write attempt.

Value: Valid UTF-8 view borrowed only for the complete call. Return: .Ok after every byte is accepted or .Err { Error = .OutputFailed }. Warning: May block and may emit a strict prefix before reporting failure.

Example

module example.print;
from std.io import Print, TryPrint;
fn Main() -> i32 {
    let ResultValue = TryPrint("recoverable\n");
    switch ResultValue {
        case .Ok => Print("complete\n");
        case .Err { Error = _ } => return 1;
    }
    return 0;
}
pub fn Print(Value: str) -> void

Writes one complete borrowed UTF-8 view or terminates fatally. Value: Valid UTF-8 view borrowed only for the complete call. Return: No value after successful complete output. Warning: May block, may emit a strict prefix, and fatal-traps without unwinding on failure.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library