This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
lesauvage's profile picture

little question, variable [SOLVED]

Started by lesauvage, 12 June 2013 - 05:26 PM
lesauvage #1
Posted 12 June 2013 - 07:26 PM
Hi, I am not sure how it is called so i can't get good answer when I search for it.

I would like the computer ask for something and then replace a variable by the answer like so:

when you open the computer:

Computer: Hi, what's your name?
You: max
Computer: Hi, Max.

so, if "Max" replace "X"
how can I get Hi, "X"

this is an exemple,

thanks for futur help


sorry for my english, I am french. Tell me if you don't understand.
Symmetryc #2
Posted 12 June 2013 - 07:38 PM
I don't fully understand, but is this what you want?

print("Hi, what's your name?")
local name = read()
print("Hi, "..name)
lesauvage #3
Posted 12 June 2013 - 07:47 PM
I don't fully understand, but is this what you want?

print("Hi, what's your name?")
local name = read()
print("Hi, "..name)

Yes, it is!

Thank you Symmetryc!
sorry for my bad explanation