+ 3

alguem pode me ajudar. ../Playground/:85:in `<main>' : undefined : method `chomp' for nil:NilClass (NoMethodError)

Hello, I'm new to Ruby, I started to learn Ruby now, and I have a problem with calling gets, I call and this error, but it is called previously in the code in the same way and it works without any problems. Olå eu sou novato em Ruby, começei a aprender Ruby agora, e estou com um problema para chamar o gets, eu chamo e da esse erro, porem ele é chamado anteriormente no código do mesmo jeito e funciona sem problema nem um.

5th Apr 2018, 3:12 PM
David Carvalho
David Carvalho - avatar
8 Answers
+ 2
Thanks for your attention, and sorry for the obvious failures, is that I'm a beginner in the language itself, I already solved the problem and the solution was quite simple by the way. But if you want to leave suggestions the code link is there and it is open to suggestions. Obrigado pela a atenção de vocĂȘs, e desculpem as falhas obvias, Ă© que eu sou iniciante na linguagem mesmo, eu jĂĄ resolvi o problema e a solução foi bem simples atĂ©. PorĂ©m se quiserem deixar sugestĂ”es o link do cĂłdigo esta ai e ele Ă© aberto a sugestĂ”es.
5th Apr 2018, 5:55 PM
David Carvalho
David Carvalho - avatar
5th Apr 2018, 5:56 PM
David Carvalho
David Carvalho - avatar
+ 2
is because in computer you have the response of your system, but in playground code you have just one response. In the Playground you have to separate the entries in ex lines: Line 1 - The input of the first gets of the code, Line 2 - The input of the second gets of the code, Line 3 - The input of the third gets of the code ...
5th Apr 2018, 9:20 PM
David Carvalho
David Carvalho - avatar
+ 1
Link to your code â˜ș
5th Apr 2018, 3:36 PM
Emma
+ 1
This is a link to your code (for other people answering) https://code.sololearn.com/cbE5OTEWnjGh/?ref=app
5th Apr 2018, 3:40 PM
Emma
+ 1
yes!
5th Apr 2018, 3:41 PM
David Carvalho
David Carvalho - avatar
0
Never apologise for being a beginner. I'll try to check it out later.
5th Apr 2018, 6:07 PM
Emma
0
gets.chomp is undefined when I try it. It doesn't seem to work in the Coding Playground. Have you tried it via a command line on your computer?
5th Apr 2018, 8:37 PM
Emma