put and print in ruby code example Example 1: ruby print puts "hello world" Example 2: ruby how to print puts "string" p "string"