I'm right, right?



"Oops, try again. Did you declare a variable called last_name?"
For your information, I did declare a variable called last_name. I copy-pasted the code of what your first name is to the areas designated to last name, city, and state, changing the questions and variable name to what the instructions asked. I don't understand what I did wrong or if I did anything wrong!
I used literally every thing I could think of, following the instructions perfectly. My instructor is unwilling to offer assistance. Is there something wrong with my code, my account, or the instructions? Your help will be greatly appreciated.

print "What's your first name?"
print "What's your last name?"
print "What city do you live in?"
print "What is the abbreviation of your state or province?"


Why have you declared the variable which collects the input as:
variable_` ?

The courses can at times be very fussy about doing things exactly as instructed. In this case, although your code would technically work, it's not what they requested. For example:

print "What is your name? "
first_name = gets.chomp

print "What is your last name? "
last_name = gets.chomp

It's looking for the variable"last_name" , which if you tried it this way would work.

In short to declare a simple variable in Ruby you do not need to state it's a variable:

first_name = "nerdywritergirl" -- This is perfectly fine


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