From: Ben Atkin Date: 2006-07-30T12:56:24+09:00 Subject: Re: not sure what is wrong. seems to look right to me ------=_Part_11593_25140850.1154231778633 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Instance variables are prefixed with an @ symbol. I would guess that you want countExch to be an instance variable. Also, I think the declaration might need to go in the initialize method. Someone who is more experienced w/ Ruby please give a more accurate and/or complete answer. Ben class ReportBuilder def initialize @countExch=Hash.new end def getStats(symbolObjColl) startCounter=0 #### add a loop to count thro symbolcollection. symbolObjColl.each{|eachSymbolObj| if (@countExch.has_key?(eachSymbolObj.exchange)) @countExch[eachSymbolObj.exchange]=@countExch[eachSymbolObj.exchange]+=1 else @countExch[eachSymbolObj.exchange]=startCounter+=1; end } puts @countExch.to_s end end -- Ben Atkin ben@benatkin.com http://www.benatkin.com/ (928) 380-0656 ------=_Part_11593_25140850.1154231778633--