From: "Sean O'Dell" Date: 2003-09-12T06:14:21+09:00 Subject: Re: Passing an Object Class from a method to a caller Michael Garriss wrote: > RLMuller wrote: > >> Hi All, >> >> I can't seem to pass an Object Class from a method to a calling routine >> >> Here's what I wrote: >> >> def getTypeOf(o) >> aTypes = [Array, String, Numeric, Fixnum, Struct, MatchData] >> result = Object >> i = 0 >> for t in aTypes >> i += 1 >> if o.is_a?t then >> result=t >> print "Index = #{i.to_s}: Type = '#{t.to_s}'\n" >> break >> end >> result >> end >> end > > > > Looks like your 'break' is passing the 'result' line and thus returning > the result of 'print'. In other words, it looks like you have the last "result" expression inside the for loop, which is probably not what you wanted. Sean O'Dell