Skip to content

Instantly share code, notes, and snippets.

@mistyrinth
Created November 20, 2018 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mistyrinth/cc0bd335004dda9d1a87178b6c49f72b to your computer and use it in GitHub Desktop.
Save mistyrinth/cc0bd335004dda9d1a87178b6c49f72b to your computer and use it in GitHub Desktop.
hash = {"りんご" => "apple", "みかん" => "orange", "ぶどう" => "grape"}
# keysメソッド
key_array = hash.keys
print(key_array, "\n")
# valuesメソッド
value_array = hash.values
print(value_array, "\n")
# to_aメソッド
array = hash.to_a
print(array, "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment