Ruby - Basics and Runtime
The following Ruby code is intended to print the array ["1", "2", "3"] with quotes and a newline, but it does not work as expected:
puts ["1", "2", "3"]What is the best fix?
puts ["1", "2", "3"]What is the best fix?
puts ["1", "2", "3"] outputputs prints each element on a new line without quotes, so output is:
1
2
3
p to print with quotes and inspect formp ["1", "2", "3"] prints the array as it is, including brackets and quotes if strings, with a newline.puts with p -> Option C15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions