Ruby
參考:Hash 官方手冊
# 使用 Hash 類別
a = Hash.new
# 使用大括號
b = {}
其實新式寫法只是語法糖衣,本質並沒有改變
# 舊式 Hash 寫法
profile = { :name => 'eddie', :age => 18 }
# Ruby 1.9 之後的新式寫法(類似 JSON 格式)
profile = { name: 'eddie', age: 18 }
profile = { name: 'eddie', age: 18 }
p profile.keys # 印出 [:name, :age]
p profile.values # 印出 ["eddie", 18]
p profile["name"] # 印出 nil
p profile[:name] # 印出 "eddie"
Familiarity with Rakuten Travel QA Workflow (Hands-On Experience)
Dec 4, 2024A compilation of essential vocabulary gathered during my internship at Rakuten, with a sum of 94.
Mar 21, 2024在 Ruby 裡,幾乎什麼東西都是物件
Mar 1, 2024create web applications in Ruby
Mar 1, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up