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

 "Hello".each_byte { |c|
     puts c
     if c == "o"
         print "oh, i got an o!", "\n"
     end
 }
=>
 72
 101
 108
 108
 111

#each_byte returns an integer character code, rather than a string, so 
the comparison fails. You could try comparing against ?o, which is the 
chapter 'o' expressed as an integer:

 "Hello".each_byte { |c|
     puts c
     if c == ?o
         print "oh, i got an o!", "\n"
     end
 }


Regards


Dave