Possible Duplicate:
What does !! mean in ruby?
Hi,
I’m new to Ruby and can’t find anywhere description of what “!!” means.
Here’s an example:
def signed_in?
!!current_user
end
If this is a double negative, why not to say:
def signed_in?
current_user
end
Please help.
In most programming languages, including Ruby,
!will return the opposite of the boolean value of the operand. So when you chain two exclamation marks together, it converts the value to a boolean.