Remove array elements in Ruby Last Updated : 20 Jul, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will learn how to remove elements from an array in Ruby. Method #1: Using Index Ruby # Ruby program to remove elements # in array # creating string using [] str = ["GFG", "G4G", "Sudo", "Geeks"] str.delete_at(0) print str Output: ["G4G", "Sudo", "Geeks" Method #2: Using delete() method - Ruby # Ruby program to remove elements # in array # creating string using [] str = ["GFG", "G4G", "Sudo", "Geeks"] str.delete("Sudo") print str Output: ["GFG", "G4G", "Geeks" Method #3: Using pop() method - Ruby # Ruby program to remove elements # in array # creating string using [] str = ["GFG", "G4G", "Sudo", "Geeks"] str.pop print str Output: ["GFG", "G4G", "Sudo"] Comment More infoAdvertise with us Next Article Ruby | Array delete_if() operation S Shivam_k Follow Improve Article Tags : Ruby Ruby Array Similar Reads Add array elements in Ruby In this article, we will learn how to add elements to an array in Ruby.Method #1: Using Index Ruby # Ruby program to add elements # in array # creating string using [] str = ["GFG", "G4G", "Sudo", "Geeks"] str[4] = "new_ele"; print str # in we skip t 1 min read How to Remove Duplicate Elements from Array in Ruby? This article focuses on discussing how to remove duplicate elements from an array in Ruby. In Ruby, an array is a fundamental data structure that stores a collection of elements in a specific order. Various methods and approaches can be used to remove duplicate elements from an array. Removing Dupli 2 min read Ruby | Array reject!() function Array#reject!() : reject!() is a Array class method which returns a new array containing the values which are not returned by the block. Syntax: Array.reject!() Parameter: Array Return: a new array containing the values not returned by the block. Example #1 : Ruby # Ruby code for reject!() method # 1 min read Ruby | Array delete_if() operation Array#delete_if() : delete_if() is a Array class method which deletes the arrays elements for which the block condition satisfies. Syntax: Array.delete_if() Parameter: block - condition for deleting the elements. Return: array after deleting the elements Code #1 : Example for delete_if() method Ru 1 min read Ruby | Array replace() function Array#replace() : replace() is a Array class method which returns an array of all combinations of elements from all arrays. Syntax: Array.replace() Parameter: Array Return: an array of all combinations of elements from all arrays. Example #1 : Ruby # Ruby code for replace() method # declaring array 2 min read How to access array Elements in Ruby In this article, we will learn how to access array elements in Ruby. In Ruby, there are several ways to retrieve the elements from the array. Ruby arrays provide a lot of different methods to access the array element. But the most used way is to use the index of an array. Using Index - ruby # Ruby p 2 min read Like