Skip to content

std/io

import "std/io" as io;
FunctionResult
print(text: String)Writes text without a newline
println(text: String)Writes text followed by a newline
eprintln(text: String)Writes text and a newline to standard error
printInt(value: Int)Writes an integer
printFloat(value: Float)Writes a Float
printFloat64(value: Float64)Writes a Float64
printBool(value: Bool)Writes a boolean
printChar(value: Char)Writes a character
getln() StringReads one line from standard input
printf(format: String, ...) IntC-style formatted output
printfln(format: String, ...) IntFormatted output followed by a newline

print, println, and eprintln are in the automatic prelude.

import "std/io" as io;
fun main() Int {
io.print("Name: ");
var name = io.getln();
io.println("Hello, " + name);
return 0;
}

The formatted functions follow the platform C runtime’s format rules. The compiler does not make a format string type-safe.