puts nil

Discussion in 'Ruby' started by S. Robert James, Feb 22, 2007.

  1. puts nil outputs "nil". Shouldn't it output "" (ie, nothing), which
    is nil.to_s?

    RDoc (for IO#print, referenced by #puts):
    Objects that aren't strings will be converted by calling their to_s
    method
     
    S. Robert James, Feb 22, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Candler

    puts nil generates "nil\n"

    Brian Candler, Nov 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    216
  2. John Carter
    Replies:
    64
    Views:
    1,065
    Klaus Stein
    May 19, 2005
  3. ako...

    a == nil or a.nil?

    ako..., Nov 22, 2005, in forum: Ruby
    Replies:
    6
    Views:
    366
    Douglas Livingstone
    Nov 23, 2005
  4. Christoffer Sawicki
    Replies:
    5
    Views:
    536
    Christoffer Sawicki
    Sep 2, 2006
  5. Arfon Smith

    puts returns nil?

    Arfon Smith, Jan 5, 2007, in forum: Ruby
    Replies:
    5
    Views:
    253
    Arfon Smith
    Jan 5, 2007
  6. Michael Brooks
    Replies:
    22
    Views:
    736
    Rick DeNatale
    Mar 27, 2007
  7. Raj Singh
    Replies:
    4
    Views:
    307
    Ryan Ingram
    Jan 29, 2008
  8. Edmond Kachale

    "puts, if and unless" VS "nil"

    Edmond Kachale, Nov 10, 2010, in forum: Ruby
    Replies:
    3
    Views:
    198
    Jesús Gabriel y Galán
    Nov 10, 2010
Loading...