From: Carlos Agarie Date: 2013-01-07T10:01:06+09:00 Subject: Re: newbie question what am I doing wrong? --14dae9340517106c0f04d2a85d1d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable When you ask a question and states that your program "won't work", it's not very helpful. You should give us examples of it "not working" and what the expected output is. In this case, I think the problem is with the "if order =3D=3D yes" line -- it's comparing `order` with a variable named `yes`, not with the corresponding string. So the correct version would be: if order =3D=3D "yes" puts 'Go ahead.' ... ----- Carlos Agarie Control engineering Polytechnic School, University of S=E3o Paulo, Brazil Computer engineering Embry-Riddle Aeronautical University, USA 2013/1/6 Lee V. > I wrote this simple program but it won't work. What am I doing wrong? > > puts 'Welcome to McDonald\'s, can I take your order?' > order =3D gets.chomp > > if order =3D=3D yes > puts 'Go ahead.' > else > puts 'Look, I asked a simple yes or no question.' > puts 'Yes, or no now, can I take your order?' > order =3D gets.chomp > end > > -- > Posted via http://www.ruby-forum.com/. > > --14dae9340517106c0f04d2a85d1d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
When you ask a question and states that you= r program "won't work", it's not very helpful. You should= give us examples of it "not working" and what the expected outpu= t is.

In this case, I think the problem is with the "if order =3D= =3D yes" line -- it's comparing `order` with a variable named `yes= `, not with the corresponding string. So the correct version would be:
<= br>
if order =3D=3D "yes"
=A0 puts 'Go ahead.'=
...

-----
Carlos Agarie

Control engineering
P= olytechnic School,=A0University of S=E3o Paulo, Brazil
Computer engineering
Embry-Riddle Aeronautical University, U= SA


2013/1/6 Lee V. <lists@ruby-forum.co= m>
I wrote this simple program but it won't work. =A0What am I doing wrong= ?

puts 'Welcome to McDonald\'s, can I take your order?'
order =3D gets.chomp

=A0if order =3D=3D yes
=A0 puts 'Go ahead.'
=A0else
=A0 puts 'Look, I asked a simple yes or no question.'
=A0 puts 'Yes, or no now, can I take your order?'
=A0 order =3D gets.chomp
=A0end

--
Posted via http://= www.ruby-forum.com/.


--14dae9340517106c0f04d2a85d1d--