5. I am stuck on what to enter when it asks" What is your first name" in the box at the right


#1

I am stuck on what to enter when it asks" What is your first name in the box at the right". I cant figure out the proper way to enter the syntax for string interpolation


#2

It should be something like:

puts "My name is #{name}!"

#3

I have tried everything I can think of, cant get nothing to let me progress. Thanks for trying


#4

Please show us some examples of what you have tried.


#5

Me to kind of stuck, I put it down 12 days ago cause I was busy starting up again on it today for an hour. I'll figure it out, its not so much as hard, but more how do I place it in the console correctly. On the console on the right it the console provides the first question "what is your name?" Do I just put "Jason" or "#{Jason}?


#6

Here is my code on the console
what's your first name? My name is "#{Justin}"
puts my last name is "#{Solo}"
puts I live in "#{Chicago}
puts the state is "#{ILLINOIS}"
"PUTS THE STATE IS \"#{ILLINOIS}\""


#7

Let's do an example that is not the same question as is in the exercise but is similar enough for you to be able to understand how print, puts and gets work.

First, prompt the user for some input, like this:

print "What colour are your eyes?"

Next, store their response in a variable, like this:

eye_colour = gets.chomp

Finally, print the response, like this:

puts "Your eyes are a lovely shade of #{eye_colour}."

When you run your program, it will ask you what colour your eyes are, then you will type in an answer and press enter/return, then it will put a sentence on the screen that uses your eye colour variable. Like this:


#9

What's your first name? puts "#{first_name}"
undefined method `jerry' for #What's your first name? "My name is "#first_

name}"

What's your first name? "My name is "#first_name}"
What's your first name? "#{gets.chomp}"
undefined method jerry' for #<Context:0x13ae9e4
What's your first name? first_name = "#{jerry}"
undefined method
jerry' for #


#10

I can't tell what is the code that you have in the editor and what is going on in the terminal window.


#11

What's your first name? n = "jerry" puts "#{jerry}"
What's your first name? puts "#{jerry}"
What's your first name? puts "My name is "#{jerry}"


#12

I still can't tell what you have written in the EDITOR and what you have written in the TERMINAL.

Here is my example again.

  • The left hand side is the EDITOR, that is where you are writing all of your code.
  • The right hand side is the TERMINAL, that is what the user sees when your program runs.

Show me exactly what you see -- just like I have shown you.


#13

I got it, your example showed me the way thanks


#14

Ok I think I know what I did wrong.....I was writing the code in the terminal instead of the editor, thanks