From: Ryan Davis Date: 2011-01-21T11:24:29+09:00 Subject: Re: Deleting from hashes On Jan 20, 2011, at 16:56 , Josh Rowe wrote: > Hi all! > Following on from my previous question > http://www.rubyforum.com/topic/912567#new > I need some help with deleting cards from a hash. Heres what I have > > #!/usr/bin/env ruby > Card = Struct.new :name, :type, :atk, :defn, :level > $deck = [ > Card["Celtic Guardian", :monster, 1400, 1200,4], > Card["Dark Magician", :monster, 2500, 2100,7], > ] > [...] > So what I need help with is deleting the card I just drew and stopping > it from being drawn again. First off, that's an array, not a hash. Second, it sounds like you could use some 'ri' love. Try this in your terminal: ri Array You should see all the methods available on Array. From there it is pretty easy to guess what you want as ruby methods are intelligently named. > Also I've heard it's bad to use global > variable but is it ok to have just one? Meh. For learning the language they're fine.