std.io Module Reference

The std.io module provides core primitives for printing to standard output and reading user input from standard input.

io_example.sp
1import std.io;
2
3fn main() -> void {
4 print("Enter your name: ");
5 let name = readLine();
6 println("Welcome to SP, ${name}!");
7}

Exported Functions

println

Native Builtin
fn println(string message) -> void

Prints the specified string message to stdout followed by a trailing newline character.

Parameters
message(string)
The text string to display.
Returns:void

print

Native Builtin
fn print(string message) -> void

Prints the specified message to stdout without appending a trailing newline.

Parameters
message(string)
The text to display.
Returns:void

readLine

Native Builtin
fn readLine() -> string

Reads a line of text from standard input up to the next newline character.

Returns:string (the entered user input without trailing newline)