Regarding the standard output used in Ruby, the difference in behavior when written with "''" or "" "" is summarized.
p 'foo', 'bar', 'baz'
#result
"foo"
"bar"
"baz"
p "foo", "bar", "baz"
#result
"foo"
"bar"
"baz"
puts('foo, bar, baz')
#result
foo, bar, baz
puts("foo, bar, baz")
#result
foo, bar, baz
print('foo\nbar\nbaz')
#result
foo\nbar\nbaz
print("foo\nbar\nbaz")
#result
foo
bar
baz
Recommended Posts