hashes

Estimated reading time: 1 minute

hashes

  • hashes are similar to dictonary
users = {
  "name" => "mostafa",
  "age" => 21,
  "status" => "dev"
}
puts users["status"]
# dev
users = {
  "name" => "mostafa",
  "age" => 21,
  "status" => {
    'now' => 'dev',
    'prev' => 'coder'
  }
}
puts "#{users["status"]["prev"]}"
# coder
ruby