This could be accomplished using a recursive method. It is more resource intensive than what you have here, but it would end up being simpler and more versatile. def mymethod(a, count=1) return if a.nil? return c.dosomething if count == 3 mymethod(a.someattribute_might_be_nil, count+1) end Peter Fitzgibbons wrote: > Hello all, > > I have this : > > def mymethod > a = someobjectreference('a') > if a.nil? > return nil > end > b = a.someattribute_might_be_nil > if b.nil? > return nil > end > c = b.someattribute_might_be_nil > if c.nil? > return nil > end > c.dosomething > end > > What is the ruby way to handle the if .nil? ladder created here? > > Thanks. > Peter Fitzgibbons > >