[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Object initialization problem

Vimal

9/25/2006 2:23:00 PM

Hi
Say I have a Hash, and an instance called wordcount, that maps strings
to a number count, that counts the occurance of the word.

I do

count = Hash.new
count[word]++ if count[word]
count[word]=1 unless count[word]

everytime! Is there a simple way to do it?

Thanks :)
Vimal

2 Answers

dblack

9/25/2006 2:28:00 PM

0

dblack

9/25/2006 2:33:00 PM

0