Loading…
december code / try / ruby
No account needed. Answer, see why, move on.
Problem
What happens when this Ruby code runs?
a = [1, 2, 3] a[5] = 6 p a
It raises IndexError: index 5 outside of array bounds: -3...3
[1, 2, 3, nil, nil, 6]
[1, 2, 3, 6]
[1, 2, 3, 0, 0, 6]
Nothing here is saved. Create a free account to keep your progress, take an assessment and get your readiness score.