Hash Problem

Hi
How can I a hash with one key and some( for example 5 ) value?

On Fri, Jul 23, 2010 at 9:58 AM, Amir E. [email protected]
wrote:

Hi
How can I a hash with one key and some( for example 5 ) value?

h = {:key => 5}

or if you want to add it later:

h = {}

h[:key] = 5

Jesus.

Amir E. wrote:

Hi
How can I a hash with one key and some( for example 5 ) value?

h = Hash.new()

h[‘a_key’] = [1,2,‘three’,4,5]

p h

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs