Ruby - Operators and Expressions
Identify the problem in this Ruby code snippet:
range = (1..5)
range.each do |n|
puts n
end
puts range[2]
range = (1..5)
range.each do |n|
puts n
end
puts range[2]
range[2] returns the third element.range[2] outputs 3 (the third number).15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions