I saw this operator in HAML code. I wonder what it is for.
I see the following works:
> ?{
=> "{"
> ?\s
=> " "
> ?a
=> "a"
And this doesn't work:
> ?ab
SyntaxError: (irb):4: syntax error, unexpected '?'
So I suppose that it takes a character a argument and returns a string with that character.
questions:
- What does this operator do?
- When should one use it?
- If it really only creates a one-character string, why was it included in the language? Doesn't it break the language orthogonality? What is the benefit?