I'm in the terminal and I'm running IRB. I'm trying to get the ASCII value of x
. I know the value is 120
. That's correct right? When I type the following into my terminal this is the response I get:
puts ?x
(output) x
Why isn't it coming up 120?
String#ord
could be used to get the integer representation of a one-character string:P.S: use
'x'
or"x"
instead of?x
.