LoginSignup
62
50

More than 5 years have passed since last update.

rubyのprint / puts / p の違い

Last updated at Posted at 2015-05-05
test.rb
print 'hello (print)' # 改行なしで出力
puts 'hello(put)' # 改行ありで出力
p 'hello(p)' # デバッグ用出力(データ形式がわかる)
$ ruby test.rb 
hello (print)hello(put)
"hello(p)"
62
50
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
62
50