Following the instructions, but it isn't working


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-MxXx5/0/6?curriculum_id=5059f8619189a5000201fbcb


Hello guys here is the error message I am getting, I watched a tutorial on this same exercise on youtube and the guy doing it successfully completes this section however he doesn't use the suggested method that is provided in the exercise which is frustrating. In the introduction they say hey we're going to introduce you to capitalize and then give you these lines of code
print "This is my question?"
answer = gets.chomp
answer2 = answer.capitalize
answer.capitalize!
I am completely brand spanking new to coding by the way so this may be idiotic, but I assumed the "This is my question?" part applied to say the print "What's your name?" and I followed the example with this in mind. The way the guy in the video did it washy going under the first_name=gets.chomp line and typing first_name.capitalize, that's it and it works. So why in the example do they put all this answer=gets.chomp etc. I was assuming answer represented whatever data you input after the question whatever it may be , What state?, What name? etc.

answer.capitalize! (ruby):20: unterminated string meets end of file


Replace this line with your code. 
print "What's your name?"
first_name=gets.chomp
answer=gets.chomp
answer2=answer.capitalize
answer.capitalize!
print "What's your last name?"
last_name=gets.chomp
answer=gets.chomp
answer2=answer.capitalize
answer.capitalize!
print "What city do you live in?"
city=gets.chomp
answer=gets.chomp
answer2=answer.capitalize
answer.capitalize!
print "What state do you live in?"
state=gets.chomp
answer=gets.chomp
answer2=answer.capitalize
answer.capitalize!
print"My name is #{first_name} #{last_name} and I live in #{city},#{state}


#2

print"My name is #{first_name} #{last_name} and I live in #{city},#{state}  //you forgot to close this

#4

1) Do exactly the same as in the course example.
2) Press Submit, in the moment when code will get in stuck you should type your inputs (name and others) in console.
3) Than press enter button. This works.


#5

What worked best for me is to ask for the first name, then last name, then state, THEN the city. The last line for me was
city = gets.chomp

i tried many different combos before getting this, including city_name, etc.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.