On Oct 31, 2007, at 7:46 AM, 7stud -- wrote:

> Gavin Kistner wrote:
>> On Oct 30, 9:30 pm, Daniel Waite <rabbitb... / gmail.com> wrote:
>>> That's clever use of ?a, which I recognize but have never seen  
>>> anyone
>>> use before. Thanks for the example!
>>
>> My current favorite use for the ?x syntax is converting single-
>> character strings representing digits into their integer form:
>>
>>   # Jenny jenny, who can I turn to?
>>   irb(main):006:0> "8675309".each_byte{ |x| p x - ?0 }
>>   8
>>   6
>>   7
>>   5
>>   3
>>   0
>>   9
>
>
> Perhaps this is clearer:
>
> "8675309".each_byte{|code| puts code.chr}
>
> ...although slightly slower.

Printed content aside, it's not equivalent.  The original code is  
making Integers, not Strings.

James Edward Gray II