alguem pode me ajudar. ../Playground/:85:in `<main>' : undefined : method `chomp' for nil:NilClass (NoMethodError) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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