Input when evaluated displays a dialog box where one can enter any character. My question is how do I restrict the input only to a certain type such as numbers or string? I know there is
InputString that takes in only strings.
This is what I have tried:
x = Input["Enter a number"]; While[Head[x] == Symbol, x = Input["Enter a number"]]
I believe there is a better solution than this. Can anyone help?
I am aware of the
InputField function. However, I am trying to implement something with the Wolfram Engine and that does not have a front end and I will be using it from the command prompt. Hence, I need to know a way to restrict the input type for the function Input.