Method: IO#puts

Defined in:
io.c

#puts(obj, ...) ⇒ nil

Writes the given objects to ios as with IO#print. Writes a record separator (typically a newline) after any that do not already end with a newline sequence. If called with an array argument, writes each element on a new line. If called without arguments, outputs a single record separator.

$stdout.puts("this", "is", "a", "test")

produces:

this
is
a
test

Returns:

  • (nil)


# File 'io.c'

VALUE
rb_io_puts(int argc, VALUE *argv, VALUE out)
{
int i;
VALUE line;

/* if no argument given, print newline. */
if (argc == 0) {
rb_io_write(out, rb_default_rs);
return Qnil;
}