I am a newbie but I'm familial with C#.
I can't find any dictionary class in Ruby.
I need to do like Dictionary<key, List<string>>
Can I do that in Ruby? If yes, how?
Big thanks!
···
--
Posted via http://www.ruby-forum.com/.
I am a newbie but I'm familial with C#.
I can't find any dictionary class in Ruby.
I need to do like Dictionary<key, List<string>>
Can I do that in Ruby? If yes, how?
Big thanks!
--
Posted via http://www.ruby-forum.com/.
I think what you seek is Hash.
On Apr 19, 2011, at 5:47 PM, Siratinee Sukachai wrote:
I am a newbie but I'm familial with C#.
I can't find any dictionary class in Ruby.
I need to do like Dictionary<key, List<string>>Can I do that in Ruby? If yes, how?
Big thanks!--
Posted via http://www.ruby-forum.com/\.
Best regards,
Zhi-Qiang Lei
zhiqiang.lei@gmail.com
Siratinee Sukachai wrote in post #993714:
I am a newbie but I'm familial with C#.
I can't find any dictionary class in Ruby.
I need to do like Dictionary<key, List<string>>Can I do that in Ruby? If yes, how?
Big thanks!
my_hash = {
'fruits' => ['apple', 'pear'],
'cars' => ['VW', 'BMW', 'Ford']
}
p my_hash['cars']
--output:--
["VW", "BMW", "Ford"]
my_hash['rocks'] = ['granite', 'quartzite']
p my_hash
--output:--
{"fruits"=>["apple", "pear"], "cars"=>["VW", "BMW", "Ford"],
"rocks"=>["granite", "quartzite"]}
--
Posted via http://www.ruby-forum.com/\.