Console

Functions for working with a console described here.

Operators

Operator

Result

Description

|| str

int

This unary operator writes a string to standard output but it trims whitespace characters in the each line before printing. Returns the number of bytes written.

run {
||`One
Two
Three
`
}
/* It prints
One
Two
Three
*/

Functions

The Print function formats using the default formats for operands of any types and writes to standard output. Spaces are added between operands when neither is a string. Print returns the number of bytes written.

Println(anytype par...) int

The Println function formats using the default formats for operands of any types and writes to standard output. Also, it writes a new line character to standard output at the end. Spaces are always added between operands. Println returns the number of bytes written.

ReadString(str text) str

The ReadString function reads the standard input until the first occurrence of '\n' (Enter key). It returns a string containing the data up to. If the text parameter is not empty, the function prints this text before reading input.