From: Matthew Bloch Date: 2010-12-05T12:44:38+09:00 Subject: Re: Verbosity of p On 05/12/10 02:55, Johny Why wrote: > hello > > why does: > puts "Inspect:#{p(myDog)}" > > give LESS verbose results than: > > p(myDog) > > ? > > is it that p returns an array, and puts only prints the first element of > arrays? "p x" is a shorthand for "puts x.inspect", i.e. it actually does the printing. The "inspect" method is what actually returns a "verbose" string. I suspect the intent of your first statement was: puts "Inspect:#{myDog.inspect}" If you call p during a string interpolation, you can expect the output to appear before the whole strong you've asked it to print, which is probably not what you wanted. -- Matthew