From: Brian Candler Date: 2010-09-03T17:31:17+09:00 Subject: Re: p vs. print Abder-Rahman Ali wrote: > When I tried to display the result using > > print ary1 > > It did NOT show anything. print(x) calls x.to_s to get the string representation, then sends that to $stdout. It looks like the object you have returns an empty string or nil from its to_s method (which is odd, but you'd have to talk to the author of the NArray class about that) puts(x) is like print(x), but adds a newline if there isn't one at the end of the string already. p(x) is like puts(x.inspect), where x converts an object into a debugging string form, that is, one which shows its internal state. Try this program to see the differences: class Foo def initialize(a) @a = a end def to_s "here's a string" end end f = Foo.new(123) print f puts f p f -- Posted via http://www.ruby-forum.com/.