is it possible to make a quick "double assignation " in a hash like in php, for example :
a={} a[:b][:c]="value"
is it possible to make a quick "double assignation " in a hash like in php, for example :
a={} a[:b][:c]="value"
I don't think so... why would you want to though? It's not that much more code to say
value = whatever_intecate_algorithm_or_calculation_you_need a[:b] = value a[:c] = value
or
a{ a=> value, b => value}
nico Itkin wrote:
is it possible to make a quick "double assignation " in a hash like in php, for example :
a={} a[:b][:c]="value"
it's actually
a = {}
=> {}
a[:a] = a[:b] = 1
=> 1
a
=> {:a=>1, :b=>1}
script/console is your friend
Peace, Phillip