0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【RubyonRails入門】 ハッシュの値を取得する

Last updated at Posted at 2019-09-10

ハッシュ入門

二段階構造のハッシュの値をとる

d = {"test" => {"japanese" => 80, "science" => 60, "English" => 90}}

"test"の中に、
さらに"japanese","science","English"のハッシュがある。

===> "japanese"の中の"kobun"の値をとりたい!!

"test"の中の"japanese"の値をとる

d["test"]["japanese"]

答えはシンプルでした。

逆に、d["test"]["japanese"]は、
d => {"test" => {"japanese" => xxx}}
となることがわかります!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?