Ruby Input and Output
puts prints a line, print does not add a newline, p shows an inspected value and gets reads input. chomp removes the trailing newline.
Example
puts "Line"
print "No newline"
puts
p "inspect"
p [1, "a", nil]
puts "a\tb"Result
Line No newline "inspect" [1, "a", nil] a b
Exercise
Show the inspected value.
[1, nil]Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.