Getting Hash to print and work with numbers

Hello everyone. Just curious about some code that I was writing. Just
trying to learn anyones input would be very helpful. Can’t figure out
how to make this work.
Here it is thank you.

Company = {
‘Emp01’ => {
‘Name’ => ‘John S.’,
‘Age’ => ‘55’,
‘Payrate’ => 5.75,
‘Hours_worked’ => 35,
‘Marital_s’ => ‘S’
},
‘Emp02’ => {
‘Name’ => ‘Jack S.’,
‘Age’ => ‘25’,
‘Payrate’ => 25.76,
‘Hours_worked’ => 60,
‘Marital_s’ => ‘M’
},
}
p Company[‘Emp01’][‘Age’]
a = Company[‘Emp01’][‘payrate’]
b = Company[‘Emp01’][‘Hours_worked’]
z = a * b
p z

Hi, you have a lowercase p in
a = Company[‘Emp01’][‘payrate’]
thats why it is not working

On Wed, Nov 3, 2010 at 2:37 PM, Sean R. [email protected] wrote:

‘Payrate’ => 5.75,
}
p Company[‘Emp01’][‘Age’]
a = Company[‘Emp01’][‘payrate’]
b = Company[‘Emp01’][‘Hours_worked’]
z = a * b
p z

A hint: check your spelling.

robert

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