Lesson 4 :repeat for more input


I can't write this code and i think that i wrote it completely wrong !

Error message is :
Oops, try again. Did you declare a variable called last_name?

my code is :

print "what's your first name?"
print " last name gets.chomp "
print " city"
print " state "


It might help clear your thinking if you understand what your code is doing.


print "what's your first name?"

is printing a message for your user -- the person who will be running your program -- in this case, it's just us. The message is to let them know what you want them to type.



is getting the user's response and storing it as first_name. You do this so that you can do other things with their answer.

If you want to collect more information, then you will need to ask more questions and store the responses in more variables. Ask your user questions that make sense for the type of information you want to collect.


Ohh thank you very much , you let me understand it .