It keeps telling me to capitalize first last and city


#1



ruby section 1.6 entitled putting the form in formatter
what would be helpful is a screenshot with an explanation of wy mine is an error
thanks...


undefined local variable or method `name' for # is my error message
how have I not capitlized first name last name and city

 
print "What's your first name?"
first_name = gets.chomp
first_name.capitalize

print "whats your last name?"
last_name =gets.chomp
last_name.capitalize

print "what city are you from?"
city = gets.chomp
city.capitalize

print "which state are you from?"
state= gets.chomp
state.upcase


first_name= "prince"
puts "#{first name}"
puts "your name is #{first_name}!"
.capitalize

last_name "harry"
puts "#{last_name}"
puts " your last name is #{last_name}!"
.capitalize

city "bedford"
puts "#{city}"
puts "you are from #{city}!"
.capitalize

state "bedfordshire"
puts "#{state}!"
puts "you are from #{state}!" 
.upcase


#2

Do you mean for a variable with the name name to be defined?
If yes, then where are you doing that?
If no, then why and where are you using something that you don't mean to be defined?


#3

i do not quite understand what you are asking however the bit of text you are asking about is what i copied and pasted from the black box in the top left


#4

That's ruby telling you what went wrong. It says you're using a name that has not been defined, so either you failed to define it or shouldn't be referring to that name at all. So you'll have to ask yourself what you meant to happen there.


#5

by defining it what do you mean? capitalizing or making it uppercase ?


#6

You're doing something like this:

# Beginning of file, nothing above this
puts aoeutnha  # error, aoeutnha hasn't been defined

So either I should have given that variable a value, or I shouldn't be using it.


#7

so basically theres nothing for ruby to capitalize


#8

Ruby doesn't try to capitalize anything, because you're using a variable that doesn't exist. And even if it existed, you aren't saying that it should be capitalized.

Go look for the undefined variable that you are using, the error message that ruby is giving you is telling you which one it is.


#9

this is what my code looks like.
rint "What is your first name?"
first_name = gets.chomp
first_name= first_name.capitalize
first_name.capitalize!
print "What is your last name?"
last_name= gets.chomp
last_name= last_name.capitalize
last_name.capitalize!
print "What city are you from?"
city= gets.chomp
city= city.capitalize
city.capitalize!
print "What State or Province are you from?"
state= gets.chomp
state= state.upcase
state.upcase!
puts "Your name is #{first_name} #{last_name} from #{city}, #{state}"

Im new to coding and not at all a pro I'm just doing what the lesson told me to do. it looks like you're missing a line and an exclaimation point!


#10

i got it working with this:

print "what's your first name?"
first_name= gets.chomp
first_name2= first_name.capitalize!
puts "Your name is #{first_name2}!"

print "What's your last name?"
last_name= gets.chomp
last_name2= last_name.capitalize!
puts "You're last name is #{last_name2}!"

print "What's your city?"
city= gets.chomp
city2= city.capitalize!
puts "You're city is #{city2}!"

print "What's your state?"
state= gets.chomp
state2= state.upcase!
puts "You're state is #{state2}!"


#11

Around the first_name variable you put
puts "#{first name}"
which is incorrect because your variable is first_name meaning just add an underscore.
Hope this helps!