"Jiangyi Liu" <jyliu / 163.net> writes:

| I met a problem when I tried to write some Ruby code to learn
| Ruby. The following code just can't work as expected,
| 
| "Hello".each_byte { |c|
|     if c == "o"
|         print "oh, i got an o!", "\n"
|     end
| }

In ruby, characters and one-element strings are different types,
unlike some other languages.

Try 'if c == ?o' insead.

-- 
http://www.dfan.org