お世話になります
下記のやりたいことの解決法をご教授いただけないでしょうか?
やりたいこと
下記のようなハッシュを空のハッシュにstoreで追加したい
irb
1irb(main):002:0> hash = {:position=>{:x=>0.0}} 2=> {:position=>{:x=>0.0}} 3irb(main):003:0> hash[:position][:x] 4=> 0.0
試したこと
irb
1irb(main):001:0> hash2 = {} 2=> {} 3irb(main):002:0> hash2.store({:position=>{:x}}, 0.0)
→SyntaxError ((irb):2: syntax error, unexpected '}', expecting =>)が発生
version
ruby 2.5.1
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/12/12 10:25