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;23fn main() -> void {4 print("Enter your name: ");5 let name = readLine();6 println("Welcome to SP, ${name}!");7}
Exported Functions
println
Native Builtinfn 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:
voidfn print(string message) -> void
Prints the specified message to stdout without appending a trailing newline.
Parameters
message(string)
The text to display.Returns:
voidreadLine
Native Builtinfn 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)