-1

I have a sentinel controlled loop that does not seem to be taking in any input whatsoever:

response = " "
until response == "x" do
  puts"
  Xargonia
  =========
  (N)ew
  (L)oad
  (O)ptions
  (Q)uit"
  reponse = gets
  puts response

When it tries to output what the user has typed in it only takes what was used to initialize.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Lexo18
  • 11
  • 2
  • Welcome to SO. I'd encourage you to read this: http://stackoverflow.com/help/how-to-ask. – orde Apr 01 '16 at 21:51
  • 1
    Welcome to Stack Overflow. It's not important to us if you're new, we only care whether you did your research and put in the effort and asked a good question. Please read "[ask]" including the last linked page, and "[mcve]". Your code won't run so it's not meeting the requirements for the second link about "[mcve]". – the Tin Man Apr 01 '16 at 21:59
  • Please, include output you get and output you expect. Also you could try to use debug output. – George Sovetov Apr 01 '16 at 22:29

1 Answers1

1

Aside from the syntax errors, you are assigning the value of gets to reponse instead of response. Also, you'll want to remove the newline character from gets by chaining String::chomp:

response = " "
until response == "x" do
  puts "                              # add space between gets and double-quote
  Xargonia
  =========
  (N)ew
  (L)oad
  (O)ptions
  (Q)uit"
  response = gets.chomp               # rename reponse to response; chain .chomp
  puts response
end                                   # add missing end
orde
  • 5,233
  • 6
  • 31
  • 33