This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_ extPart_001_01C06B5C.100B4070
Content-Type: text/plain;
charset o-8859-1
Content-Transfer-Encoding: 7bit
ruby -e '"abc".each_byte {|b| p b }'
97
98
99
-> each_byte returns the ascii code...
maurice
#
# 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
------_ extPart_001_01C06B5C.100B4070
Content-Type: text/html;
charset o-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV
ontent-Type" CONTENT ext/html; charset o-8859-1">
<META NAME enerator" CONTENT S Exchange Server version 5.5.2651.75">
<TITLE>RE: [ruby-talk:7867] Comparsion Problem?</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE ruby -e '"abc".each_byte {|b| p b }'</FONT>
<BR><FONT SIZE 97</FONT>
<BR><FONT SIZE 98</FONT>
<BR><FONT SIZE 99</FONT>
</P>
<P><FONT SIZE -> each_byte returns the ascii code...</FONT>
</P>
<P><FONT SIZE maurice</FONT>
</P>
<BR>
<P><FONT SIZE # </FONT>
<BR><FONT SIZE # I met a problem when I tried to write some Ruby code to learn </FONT>
<BR><FONT SIZE # Ruby. The</FONT>
<BR><FONT SIZE # following code just can't work as expected,</FONT>
<BR><FONT SIZE # </FONT>
<BR><FONT SIZE # "Hello".each_byte { |c|</FONT>
<BR><FONT SIZE # if c "o"</FONT>
<BR><FONT SIZE # print "oh, i got an o!", "\n"</FONT>
<BR><FONT SIZE # end</FONT>
<BR><FONT SIZE # }</FONT>
<BR><FONT SIZE # </FONT>
<BR><FONT SIZE # Seems in Ruby, in the comparsion c and "o" is always false. </FONT>
<BR><FONT SIZE # How can I make</FONT>
<BR><FONT SIZE # the above code right? Thanks a lot.</FONT>
<BR><FONT SIZE # </FONT>
<BR><FONT SIZE # Jiangyi Liu</FONT>
</P>
</BODY>
</HTML>
------_ extPart_001_01C06B5C.100B4070--