Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby hash with default value

hash = Hash.new(:default_value)
hash[:foo] = 'bar'
hash[:foo] #=> 'bar'
hash[:inexistent] #=> :default_value
 
PREVIOUS NEXT
Tagged: #ruby #hash #default
ADD COMMENT
Topic
Name
4+6 =