I saw this operator in HAML code. I wonder what it is for.
I see the following works:
> ?{
=> \"{\"
> ?\\s
=> \" \"
> ?a
=> \"a\"
“?” mark in a ruby method indicates that method will return either true or false.
After checking method name we can determine that this method is going to return boolean value.
Example:
empty? - This method will check whatever the object is empty or not. Depending on that it will return true or false.
Uses:
[1,2,3].empty? - return false
[].empty? - return true