Sorry for such a naive question but can someone let me know what is the ruby way of writing the below line of code
result.nil? ? false : !result
CodePudding user response:
According to your comment:
- if result is
true
then returnfalse
- if result is
false
then returntrue
- if result is
nil
then returnfalse
you just need to check for result == false
:
result = true
result == false #=> false
result = false
result == false #=> true
result = nil
result == false #=> false