What does the !! mean in this Ruby function?
def is_i?
!!(self =~ /^[-+]?[0-9]+$/)
end
What does the !! mean in this Ruby function?
def is_i?
!!(self =~ /^[-+]?[0-9]+$/)
end
It makes sure the response is a boolean. So nil
or false
wil become false
, any other value becomes true