Reputation: 3247
Is there a way to do something like this:
numbers = {
"one" => "two",
"three" => numbers["one"] }
I know I can just make the hash and set everything normally like numbers["one"]
but ugly...
Upvotes: 0
Views: 102
Reputation: 124642
No, because numbers
is not yet defined, but you can make the items assigned more than once a variable:
# seems odd, but ok...
def_num = "two"
numbers = { 'one' => def_num, 'two' => def_num }
Upvotes: 1