Using none?, you can have ifinstead unless:
if [a,b,c,d,e,f,g].none?(&:nil?)
Think about it, it can be reduced to a simple:
if [a,b,c,d,e,f,g].all?
if you don't mind processing falsejust likenil
Is there a more efficient way to write the following?
I think the best question is: "Is there a more expressive way to write ..."
source
share