S
Sean Stephenson
Hi all, this is my first post to the Ruby Forum. Cheers. And thanks for
helping out a newb.
Quesiton: How do you access multiple values from a hash?
For Example, I have a hash of computer names, and their associated user.
the_system = {
"computer-01"=>"jill",
"computer-02"=>"jack",
"computer-03"=>"bob"
}
If I want to access the user of one machine, this works great:
puts the_system["computer-01"]
=>jill
But how do I return multiple user names? (The below throws an error:
'wrong number of arguments'.)
puts the_system["computer-01", "computer-02"]
Thanks.
helping out a newb.
Quesiton: How do you access multiple values from a hash?
For Example, I have a hash of computer names, and their associated user.
the_system = {
"computer-01"=>"jill",
"computer-02"=>"jack",
"computer-03"=>"bob"
}
If I want to access the user of one machine, this works great:
puts the_system["computer-01"]
=>jill
But how do I return multiple user names? (The below throws an error:
'wrong number of arguments'.)
puts the_system["computer-01", "computer-02"]
Thanks.