if firstcheck? || secondcheck?
nil
else
true
end
How can i reduce this block of code to one single line? If the condition is correct i need to return nil, else true
Please help
if firstcheck? || secondcheck?
nil
else
true
end
How can i reduce this block of code to one single line? If the condition is correct i need to return nil, else true
Please help
This line is equivalent to the snippet of code you wrote:
true unless firstcheck? || secondcheck?
I have to wonder if you really have a requirement to return nil
instead of false
. If you are OK with returning false
instead of nil
, you could write it as:
!firstcheck? && !secondcheck?