From: Andrew Wagner Date: 2010-09-03T04:44:09+09:00 Subject: Re: p vs. print --001636c5a4628bf7b4048f4c0956 Content-Type: text/plain; charset=UTF-8 Actually, "p x" is equivalent to "puts x.inspect", not "puts x" On Thu, Sep 2, 2010 at 3:40 PM, Quintus wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 02.09.2010 21:23, schrieb Alex Stahl: > > Ruby uses "puts", not "print". "p" is short for "puts". > > > > Try this: > > > > puts ary1 > > > > You'll get the same results as: > > > > p ary1 > > > > > > This is definitely wrong. #p is quite another method than #puts and yet > another than #print. Look at this: > > irb(main):001:0> puts [1, 2, 3] > 1 > 2 > 3 > => nil > irb(main):002:0> p [1, 2, 3] > [1, 2, 3] > => [1, 2, 3] > irb(main):003:0> print [1, 2, 3] > [1, 2, 3]=> nil > irb(main):004:0> > > Vale, > Marvin > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkx//a4ACgkQDYShvwAbcNm6WACeIQJ9iRiMc0pWK2b5WLyyp0dF > w4cAnjhR1ivOKumpbjiIyiM3x5WXxH1O > =3hf3 > -----END PGP SIGNATURE----- > > --001636c5a4628bf7b4048f4c0956--