A little confused


#1



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


No error message but it still works. The .capitalize! isn't capitalizing and my last_name isn't working either. I also do not undestand why my code is making me jump a coupkle lines before I can type in my next answer.


Replace this line with your code. 

print "What's your first name?"

first_name = gets.chomp

print "What is you'r last name?"

answer = gets.chomp

answer = answer.capitalize 

answer.capitalize!

last_name = gets.chomp

answer = gets.chomp

answer = answer.capitalize

answer.capitalize!

print "What city do you live in?"

city = gets.chomp

answer = gets.chomp

answer = answer.capitalize

answer.capitalize!

print "What state do you live in? Please use an abbreviation!"

state = gets.chomp.upcase!


puts "So you'r first name is #{first_name}, and you'r last name is #{last_name}, but! You live in #{city} around #{state}"


#2

This line can be removed in all three instances. What is happening is that the line above is capitalizing answer, then this line is not finding any lowercase so returns nil.


#3

Just figured it out, thanks for the help!


#4

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