# How do I include both text and variables in Input[ ]?

I want to prompt a user to input an answer to a question. I want the question that pops up to have both text and numbers or strings. For example, if I ask the user to give a name to something in the first question, I want the next question to include that name as part of the question itself.

For example, I can prompt the user to name an element,

name=InputString["What is the name of your material?"]


I want the next input to be something like the question, "What is the molar weight of name?", where "name" is the input from the previous question. If the argument for Input[] were similar to Print[], it would look something like,

Input["What is the molar weight of ",name,"?"]


But this does not work because Input[] treats this as three different arguments, delimited by commas. Any thoughts?

-

You have to use StringJoin. In other cases you might also need to convert your variable into a string using ToString.
name=InputString["What is the name of your material?"]