I\'m just breaking into the ruby world and I could use a helping hand.
Suppose b is nil.
b
nil
I\'d like the following code to return n
n
"try" is very clean, as lucapette said. More generally, you could also use a begin-rescue-end block too, depending on your situation.
begin a.b.c("d").e rescue NoMethodError=>e return nil end