Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > puts nil

Reply
Thread Tools

puts nil

 
 
S. Robert James
Guest
Posts: n/a
 
      02-22-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what's the diff between puts y and puts "#{y}" in class_eval Raj Singh Ruby 4 01-29-2008 10:16 PM
Suggestion: swap name of "puts" and "print" and rename "puts" to"put_s" Michael Brooks Ruby 22 03-27-2007 04:57 PM
puts returns nil? Arfon Smith Ruby 5 01-05-2007 10:05 AM
Integer(nil) versus Float(nil) versus String(nil) Christoffer Sawicki Ruby 5 09-02-2006 06:28 PM
puts nil generates "nil\n" Brian Candler Ruby 1 11-06-2004 01:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57