I only thought it could possibly be homework because you said you "need to use '?'". The loop I gave you would do the same thing - it would list the ASCII values. Since you rejected it and said you needed to use '?' I thought it may be a homework requirement or something. In any case, iterating a loop like you tried doesn't work because of the way '?' is defined. However, if you use eval, you can use an index and then evaluate the expression.
- for index in 'A'..'Z' do
-
puts eval("?#{index}")
-
end
This will fill in the index, then get the ? value of that index. For defining a character, I don't think Ruby actually has a character class. So you would probably use the same method as you would for a string, char = 'A'. I'm still fairly new to Ruby myself, so I don't know if there's a better way to do characters. If so, I haven't found it.