Ruby. lesson 5 printing the input


#1

I don't know what im doing wrong. Please can any one help
print"Whats your first name?"
first_name=gets.chomp
puts"your first name is#{name}"
print"Whats your last name?"
last_name=gets.chomp
puts"your last name is#{last_name}"
print"Which city where you born?"
city=gets.chomp
puts"your where born in#{city}"
print"which state are you from. Abreviation will do"
state=gets.chomp
puts"You are from#{state}"


#2

@lukebarnard72
Can you tell us what the instructions want you to do? That will be very helpful.


#3

i am trying to do lesson 5.
Let's use this syntax to print out the values of first_name, last_name, city, and state using #{} syntax.


#4

this is the actual code i have put in
print"Whats your first name?"
first_name=gets.chomp
puts"your first name is#{name}"
print"Whats your last name?"
last_name=gets.chomp
puts"your last name is#{last_name}"
print"Which city where you born?"
city=gets.chomp
puts"your where born in#{city}"
print"which state are you from. Abreviation will do"
state=gets.chomp
puts"You are from#{state}"

but get this error
Whats your first name? luke
undefined local variable or method `name' for #


#5

@lukebarnard72

Look here

first_name=gets.chomp
puts"your first name is#{name}"

The 'name' is undefined because you didn't declare any variable called 'name'. Instead, you should put 'first_name'. Hope this helped you!


#6

this is how i did it and it still says something is wrong

print "What's your first name?"= gets.chomp
print "What's your last name?"= gets.chomp
print "From what city are you?"= gets.chomp
print "From what state/province are you?"= gets.chomp

first_name= "David"=gets.chomp
puts "Your name is #{first_name}!"
last_name= "Ristic"=gets.chomp
puts "Your last name is #{last_name}! "
city= "Beograd"=gets.chomp
puts "You are from #{city}!"
state= "Srbija"=gets.chomp
puts "You'r state is #{state}!"