Skip to content

io

import io
FunctionSignatureDescription
read_line() -> StringRead a single line from standard input
print(String) -> UnitPrint a string to stdout without a trailing newline
read_all() -> StringRead all of standard input as a single string
write_bytes(List[Int]) -> UnitWrite raw bytes to stdout (no UTF-8 conversion)
write(Bytes) -> UnitWrite a Bytes buffer to stdout (zero-copy, buffered)

Read a single line from standard input

let name = io.read_line()

Print a string to stdout without a trailing newline

io.print("Enter name: ")

Read all of standard input as a single string

let input = io.read_all()

Write raw bytes to stdout (no UTF-8 conversion)

io.write_bytes([0x50, 0x34, 0x0A])

Write a Bytes buffer to stdout (zero-copy, buffered)

io.write(buf)

Read a single byte from stdin (returns -1 on EOF).

let b = io.read_byte()

Read N bytes from stdin (may return fewer on EOF).

let data = io.read_n_bytes(4)