Skip to content

Tag Archives: Ruby Array-class

to_s() is an Array class method which returns the string representation of the array elements. Syntax: Array.to_s() Parameter: Array Return: string representation of the array… Read More
Inspect() is an Array class method which returns the all array elements. Syntax: Array.inspect() Parameter: Array Return: all array elements Example #1 : # Ruby… Read More
insert() is a Array class method which returns the array by inserting a given element at the specified index value. Syntax: Array.insert() Parameter: Array index… Read More
index() is an Array class method which returns the index of the first object in the array. Syntax: Array.index() Parameter: Array obj – object to… Read More
hash() is an Array class method which returns the hash code of the array elements Syntax: Array.hash() Parameter: Array Return: hash code of the array… Read More
flatten!() is a Array class method which returns the flattened the array and returns nil if there is no modification required Syntax: Array.flatten!() Parameter: Array… Read More
flatten() is an Array class method which returns flattened array i.e. a 1D array Syntax: Array.flatten() Parameter: Array Return: 1D array Example #1 : #… Read More
first() is a Array class method which returns the first element of the array or the first ‘n’ elements from the array. Syntax: Array.first() Parameter:… Read More
Array#() : () is an Array class method which performs the comparison between the two arrays. Syntax: Array.() Parameter: Array for the comparison Return: -1… Read More
abbrev() is an Array class method which provides unambiguous set of abbreviations for the string.  Syntax: Array.abbrev()Parameter:– string for abbreviation – pattern [optional]Return: unambiguous abbreviations set… Read More
Array#find_index() : find_index() is a Array class method which returns the index of the first array. If a block is given instead of an argument,… Read More
Array#fill() : fill() is a Array class method which fills the array with the element and that can be in a specific range. Syntax: Array.fill()… Read More
Array#fetch() : fetch() is a Array class method which returns the element at the argument index position. Syntax: Array.fetch() Parameter: index value Return: element at… Read More
Array#include?() : include?() is a Array class method checks if the argumented object is present in the array or not. Syntax: Array.include?() Parameter: obj –… Read More
Array#frozen?() : frozen?() is a Array class method which checks whether the array is frozen (or temporarily frozen while being sorted) Syntax: Array.frozen?() Parameter: Array… Read More

Start Your Coding Journey Now!