small medium large xlarge

Generic-user-small
15 Feb 2016, 19:03
Ashwin Kumar (6 posts)

When running the chomp method for the full name greeting, I get an undefined method or uninitialized error. Is there an extra step involved that causes the f_name, m_name, and l_name to be completed.

Chris_beach_pragsmall
17 Feb 2016, 02:06
Chris Pine (72 posts)

Can you post your code that is having problems, as well as posting the error message? Otherwise, I really have no idea what’s not working for you. :-)

Generic-user-small
17 Feb 2016, 04:55
Ashwin Kumar (6 posts)

I’ll type in:

puts ‘What is your first name?’ f_name = gets.chomp puts “What is your last name?’ l_name = gets.chomp

full_name = f_name + l_name

puts ‘Hello, ‘ + full_name + ‘!’

Then, when I choose run it leads to Error: File calc.rb; Line 39 on text editor: in ‘': undefined method 'chomp' for nil:Nil Class (no method error)

Chris_beach_pragsmall
17 Feb 2016, 16:44
Chris Pine (72 posts)

That error says “Line 39”, but you only posted a few lines of code. Try putting only the code for this program in a separate file and running it. See if that helps.

Generic-user-small
23 Feb 2016, 04:33
Ashwin Kumar (6 posts)

So I typed out the code in a separate file in the text editor and it gives me a notification which states that the file doesn’t appear to contain a valid ‘shebang’ line. Could it be that I didn’t save it properly?

You must be logged in to comment