From: Martin DeMello Date: 2005-04-14T14:29:37+09:00 Subject: Re: newbie question re: variable assignment Simon.Mullis@equinoxsolutions.com wrote: > > If I want to convert in the other direction - i.e get the ASCII value > for the characters (1..9)... > > 1.upto(9) { |x| puts ?x } > > Does not work - it give me the ASCII code for x (which is 120) nine > times > > How can I force ruby to treat the "x" as a variable and not as "x". ($x > from perlland) Just to clarify things, the ? notation is a literal value, not a function call of any sort. It's analogous to constructs like 0xFF (literal hex number) or for that matter 1.45 (literal floating point value). martin