Skip to main content
Version: Next

IO

Module Function​

open(STRING, [STRING], [STRING])​

Returns FILE

Opens a file pointer to the file at the path, mode and permission can be set optionally.

IO.open("main.go", "r", "0644")
Output
<file:main.go>

read_line()​

Returns STRING|NIL|ERROR

Reads a single line from standard input, with the trailing newline removed. Returns nil at the end of input, which is not an error but the normal way a piped program ends. A genuine read failure, unlike end of input, returns an error.

IO.read_line()
Output
"hello"

write(ANY...)​

Returns NIL

Writes the given value(s) to standard output without appending a trailing newline. Strings are written as their raw value; use print when a trailing newline is wanted.

IO.write("Progress")
IO.write(".")
IO.write(".")
IO.write(".")
Output
Progress...

Properties​

NameValue