Ruby - Loops and Iteration
Which of the following is the correct syntax for iterating over an array
arr in Ruby?arr in Ruby?each is the standard iterator for collections in Ruby.arr.each { |item| puts item }, which is correct syntax. The for loop "for i in arr puts i end" has invalid syntax (missing 'do'), options C and D use invalid method names.each with block syntax for iteration [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions