From: Matt Mongeau Date: 2013-03-05T04:33:26+09:00 Subject: Re: Can't get If statement right --089e016354c624036704d71e6ea8 Content-Type: text/plain; charset=ISO-8859-1 As for your loop quandary, you should try some of these options. I'll leave it to you to decide which you like best: http://www.ruby-doc.org/core-2.0/Kernel.html#method-i-loop or either of the solutions in the loops section of http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Control_Structures#Loops On Mon, Mar 4, 2013 at 2:27 PM, Matt Mongeau wrote: > You should be getting something like: > > undefined local variable or method `quit' for main:Object I'd suggest > examining that line to see what you've done wrong. > > Lastly, when you use gets there will be a newline at the end of the input. > For example, > > irb(main):001:0> foo = gets > hello > => "hello\n" > > You can use http://www.ruby-doc.org/core-2.0/String.html#method-i-chompto take care of it. > > > On Mon, Mar 4, 2013 at 2:20 PM, Kat VS wrote: > >> Okay, thanks! Now it is working. I figured it was thinking they were >> integers, and I tried putting quotes around the 1, 2, and 9, but that >> still didn't work either. >> >> But, now, the if statement in the option == 9 elsif section isn't doing >> anything? >> >> And how would I get the program to just loop over and over until the >> person quit? >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > --089e016354c624036704d71e6ea8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
As for your loop quandary, you should try some of these op= tions. I'll leave it to you to decide which you like best:


or either of the solutions in the loops sec= tion of



O= n Mon, Mar 4, 2013 at 2:27 PM, Matt Mongeau <halogenandtoast@gma= il.com> wrote:
You shoul= d be getting something like:

undefined local variable or= method `quit' for main:Object I'd suggest examining that line to s= ee what you've done wrong.

Lastly, when you use gets there will be a newline at the end of = the input. For example,

irb(main):001:0> f= oo =3D gets
hello
=3D> "hello\n"

=


On Mon, Mar 4, 2013 at= 2:20 PM, Kat VS <lists@ruby-forum.com> wrote:
<= div>
Okay, thanks! Now it is working. I figured it was thinking they were
integers, and I tried putting quotes around the 1, 2, and 9, but that
still didn't work either.

But, now, the if statement in the option =3D=3D 9 elsif section isn't d= oing
anything?

And how would I get the program to just loop over and over until the
person quit?


--089e016354c624036704d71e6ea8--