Ruby - Arrays
The following Ruby code throws an error. What is the problem?
arr = [5, 10, 15] puts arr.first() puts arr[-4]
arr = [5, 10, 15] puts arr.first() puts arr[-4]
arr.first() usagefirst() can be called with or without parentheses; no error here.arr[-4]nil, which prints as empty line, no error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions