I see two styles of writing the same thing:
def find_nest(animal)
return unless animal.bird?
GPS.find_nest(animal.do_crazy_stuff)
end
vs
def find_nest(animal)
if animal.bird?
GPS.find_nest(animal.do_crazy_stuff)
end
end
Which one is more correct/preferable/following-best-practises? Or it does not matter?
GPS.find_nest(animal.do_crazy_stuff) if animal.bird?
– ChiuBird
class (descendant ofAnimal
) and implementBird#find_nest
without arguments asdef find_nest; GPS.find_nest(do_crazy_stuff); end
. – Chiu