Ruby: Print
To print, use p, puts, print.
a = 5 b = "rabbit" p a, b, 3 # prints each on a new line.
parenthesis optional
p a, b, 3
can be written as
p(a, b, 3)
parenthesis are often not necessary
Difference between puts, p, print
putsprints in a human readable form, and adds newline after each argument. For example, string is printed without quotes, array are printed without the brackets or separators.pprints in a technical form. e.g. string include the quotes. This is good for debugging.printis similar to “puts” but does not add newline.