From: dblack@... Date: 2003-09-12T06:29:17+09:00 Subject: Re: Passing an Object Class from a method to a caller Hi -- On Fri, 12 Sep 2003, 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'. I think it's actually returning the result of break, which is nil (but can be assigned with "break val" in 1.8.0). David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav