Lesson 4 :repeat for more input


#1



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?"
first_name=gets.chomp
print " last name gets.chomp "
print " city"
print " state "
`


#2

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

This:

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.

This:

first_name=gets.chomp

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.


#3

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


#5