What does !! mean in ruby?
?
is used to represent single character string literals. Like ?a
,?b
but not ?ab
.
To answer the comment of OP :
Yes, they are.
irb(main):001:0> ?x + 'y'
=> "xy"
irb(main):002:0> 'x' + 'y'
=> "xy"
$> "/" == ?/
=> true
another version of string but shorter :)
also true: %{/}
In Ruby 1.8.x series, it return ASCII value
alok@alok-desktop:~$ rvm use ruby-1.8.7-p370
Using /home/alok/.rvm/gems/ruby-1.8.7-p370
alok@alok-desktop:~$ irb
1.8.7-p370 :001 > ?F
=> 70
In Ruby 1.9+ it returns same character string
1.9.2-p320 :018 > ?A
=> "A"