Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How do you remove nil values in array using ruby?



How do you remove nil values in array using ruby?..

Answer / Ravi Prabhat

You can use the `delete_if` method to remove all nil values from an array in Ruby. For example: `my_array.delete_if {|element| element.nil?}`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

What is the difference between #== and #eql??

1 Answers  


Please explain what is mvc and why do we use it?

1 Answers  


In how many ways items can be removed from array in Ruby?

1 Answers  


Explain when self.up and self.down method is used?

1 Answers  


Do you know how ruby looks up a method to invoke?

1 Answers  


How do you remove nil values in array using ruby?

1 Answers  


Explain the use of ensure statement in Ruby?

1 Answers  


What does irb stand for?

1 Answers  


What is the use of global variable $ in Ruby?

1 Answers  


What are the loops in ruby?

1 Answers  


What are advantages of using ruby?

1 Answers  


mention what is the difference between a single quote and double quote?

1 Answers  


Categories