Results look good but error still?


#1



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


My results look good, but I keep getting this error message
"Oops, try again. Make sure to call capitalize! on first_name, last_name, and city."
Help please!


print "What's your first name?"
first_name=gets.chomp
first_name1=first_name.capitalize
puts "Her first name is #{first_name1}"


print "What's your last name?"
last_name = gets.chomp
last_name1=last_name.capitalize
puts "Her last name is #{last_name1}"

print "What city do you live in?"
city = gets.chomp
city1=city.capitalize
puts "She lives in #{city1}"

print "What state abbreviation?"
state = gets.chomp
state1=state.upcase!
print "#{state1}"


#2

You're missing the exclamation marks on the capitalized methods.

first_name1=first_name.capitalize!
last_name1=last_name.capitalize!
city1=city.capitalize!

I hope this helps! :slight_smile:


#3

Thanks! Do you mind explaining the reason for using the exclamation marks?


#4

You're welcome.

I'm not going to come in too technical on this.

! - when used on a method, modifies the object on which that method was called on - kinda permanently.

In another case, you might have seen or will see ? on methods.

? - says it's going to return a Boolean.

I hope this helps. :wink:


#5

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