Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

change elements in ruby hashes

> favorite_colors["eyes"] = "green"       # Changing an item
=> "green"
> favorite_colors
=> {"eyes"=>"green", "hair"=>"blonde"}
> favorite_colors["skin"] = "suburned"    # Adding a new item
=> "sunburned"
> favorite_colors
=> {"eyes"=>"blue", "hair"=>"blonde", "skin"=>"sunburned"}
Source by www.eriktrautman.com #
 
PREVIOUS NEXT
Tagged: #change #elements #ruby #hashes
ADD COMMENT
Topic
Name
4+4 =