Icon_search

Items tagged with "array"

Show:  All  |  News Items  |  Blog Posts

News Items

There are no news releases with that tag.


Blog Posts

Arrays: Iterating + Deleting = BAD

Jun 19, 2008 by Colin

Going through some legacy Ruby code that I'm updating for a client, I came across a seemingly random problem where some elements of an array weren't being removed properly. Here's a simplified version. Can you see the problem? @example_array = ["a","b","c","d","e","f"] @example_array.each do |example_element| @example_array.delete(example_element) end ...

Tagged: array, iterate, delete