Jiangyi Liu wrote: > > Hi all, > > 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 > } > > Seems in Ruby, in the comparsion c and "o" is always false. How can I make > the above code right? Thanks a lot. > > Jiangyi Liu You're comparing strings to characters, which has to fail. To specify the character o, change "o" to ?o above. -- Mark