puts, print, and p?

  • puts → prints output with newline.
  • print → prints without newline.
  • p → prints with debugging info (shows object’s raw form).

Example:

puts "Hello"   # Hello (new line)
print "Hello"  # Hello (no new line)
p "Hello"  

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *