On Fri, Jan 21, 2011 at 10:44 AM, Josh Rowe <joshua / wired.com.au> wrote: > Thank you all, now for the issue of that being an array. I made a > mistake in which code to copy and paste. This is the hash > > card1 = {:name => "Celtic guardian", :type => "monster", :atk => 1400, > :def => 1200, :level => 4} > card2 = {:name => "Dark Magician", :type => "monster", :atk => 2500, > :def => 2100, :level => 7} > $deck = [card1,card2] > def draw > ¨Âòáòáî䨤äåãë®óéúå© > ¨Âõô¢ùïõ äòå÷ ôèãáòä £û¤äåãëÛäòá÷Ý®îáíåý¢ > deck.delete(draw) > end > draw Still, $deck is an Array and you want to delete from $deck and not from any of the Hashes in the Array! > This is what I think it should look like. Please rethink. 10:55:44 ~$ ri19 Array#delete Array#delete_at Array#delete (from ruby core) ------------------------------------------------------------------------------ ary.delete(obj) -> obj or nil ary.delete(obj) { block } -> obj or nil ------------------------------------------------------------------------------ Deletes items from self that are equal to obj. If any items are found, returns obj. If the item is not found, returns nil. If the optional code block is given, returns the result of block if the item is not found. (To remove nil elements and get an informative return value, use #compact!) a = [ "a", "b", "b", "b", "c" ] a.delete("b") #=> "b" a #=> ["a", "c"] a.delete("z") #=> nil a.delete("z") { "not found" } #=> "not found" Array#delete_at (from ruby core) ------------------------------------------------------------------------------ ary.delete_at(index) -> obj or nil ------------------------------------------------------------------------------ Deletes the element at the specified index, returning that element, or nil if the index is out of range. See also Array#slice!. a = %w( ant bat cat dog ) a.delete_at(2) #=> "cat" a #=> ["ant", "bat", "dog"] a.delete_at(99) #=> nil 10:56:05 ~$ > What do you all think regarding using arrays or hashes in my card game? > Any thoughts would be appreciated. No idea as I don't know what your game is about and how it is supposed to be played. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/