Skip to content
Justice Tech School

puts, print and p

puts adds a newline, print does not and p shows the inspect form. gets reads input.

Example
puts "a", [1, 2]
print "no newline"
puts
p "text", :sym, nil
puts "%.2f|%05d" % [3.14159, 42]

Result

a
1
2
no newline
"text"
:sym
nil
3.14|00042

Exercise

Debug print.

 x

Quiz Test

What does p show?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.