-
-
Save mistyrinth/7d1295e86261208e85e3de4c37d5ffda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hash = {"ワンピース" => 2000, "スカート" => 1000, "ブラウス" => 1500} | |
# デフォルトの設定 | |
hash.default = "none" | |
print("ワンピースの価格は ", hash["ワンピース"], " 円です。\n") | |
print("スカートの価格は ", hash["スカート"], " 円です。\n") | |
print("ブラウスの価格は ", hash["ブラウス"], " 円です。\n") | |
print("カーディガンの価格は ", hash["カーディガン"], " 円です。\n") | |
# 値の変更 | |
hash["スカート"] = 850 | |
# キーの追加 | |
hash["カーディガン"] = 1200 | |
print("価格が変わりました!\n") | |
print("スカートの価格は ", hash["スカート"], " 円です。\n") | |
print("カーディガンの価格は ", hash["カーディガン"], " 円です。\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment