Course Content

Course Content

FAQs

  • Assigning values to an array: This method assigns values to each element in the array.
  • Indexing into an array: This method takes the index of an element and returns the value of that element.
  • Appending elements to an array: This method adds new elements at the end of an existing array.

An array is a collection of objects that are stored in the same place. This allows the programmer to access them without having to search for them.

Ruby arrays can be manipulated in two ways - by using the [] operator or by using the methods defined on Array class. The [] operator is used to get or set the value of an array element while the methods are used to iterate over it, create new arrays, and sort them.

  • They are faster than other types of data structures
  • They can be indexed with numbers, strings, symbols and even objects

Array methods are:

  • Array#length - returns the number of elements in an array
  • Array#subarray - returns a new array with a subset of the original array's elements
  • Array#slice - returns a new array with a section of an original array's elements

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere