alguem pode me ajudar. ../Playground/:85:in `<main>' : undefined : method `chomp' for nil:NilClass (NoMethodError) | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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