adplus-dvertising
frame-decoration

Question

What is the purpose of the square brackets [] in Ruby when working with arrays?

a.

To denote comments

b.

To indicate string literals

c.

To enclose variable names

d.

To define array elements

Answer: (d).To define array elements Explanation:In Ruby, square brackets [] are used to define and access array elements.

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the purpose of the square brackets [] in Ruby when working with arrays?