Ruby - Arrays
What is the output of the following Ruby code?
arr = [1, 2, 3, 4] puts arr.length
arr = [1, 2, 3, 4] puts arr.length
length method returns the number of elements in the array, which is 4 here.puts prints the number 4 to the screen.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions