Single-character output : STDOUT « Language Basics « Ruby






Single-character output


o = STDOUT
 
o.putc(65)         # Write single byte 65 (capital A)
o.putc("B")        # Write single byte 66 (capital B)
o.putc("CD")       # Write just the first byte of the string

 








Related examples in the same category

1.String output to STDOUT