Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO#putc

ios.putc(obj) → obj

If obj is Numeric, write the character whose code is the least-significant byte of obj. If obj is String, write the first character of obj to ios. Otherwise, raise TypeError.

Example
$stdout.putc "A"
$stdout.putc 65

produces:

Example
AA
See also #printf #puts #print #pwrite also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0