IO is the class for basic input/output.

Static Methods

input()

Get a line from the standard input. The line may be truncated if it is too long. The line may end with a newline character.

def input = IO.input()

See also: input(message)

input(message)

Print the message and get a line from the standard input. The line may be truncated if it is too long. The line may end with a newline character.

def input = IO.input("What is the answer?\n") #> What is the answer?

See also: input()

print(obj)

Print obj to the standard output without a newline at the end. obj is converted to a string by calling the .to_s method.

IO.print(3 + 5) #> 8
IO.println()

See also: println(obj)

println()

Print a newline to the standard output.

See also: println(obj)

println(obj)

Print obj to the standard output and a newline at the end. obj is converted to a string by calling the .to_s method.

IO.println([ 1, 'a' ]) #> [1, a]

See also: println(), print(obj)

write(byte)

Write a byte (an Int between 0 and 255) to the standard output.

IO.write(0x40) # @
IO.write(0x0A) # \n
#> @