HP Forums

Full Version: Now don't run ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
An old program from Mic Nick now don't run. I don't know why, may be help ?

Thanks.
Hello,

The reason is because when INPUT(f,"...") is run, the expression you type is EVALUATED. If X=2, and you type X^2-1, on exit the INPUT form evaluates and you get 2^2-1, or 3 as your value for f.

You can either put your expression inside ' ' using the two keys [SHIFT][ ( ) ], or put in " " around your expression.

'X^2-1' or "X^2-1" will both work.

You can modify the program to be like this to avoid needing to do ' ' or " ".

INPUT({{f,[2]}}, ....);
Hi Tim,
Very many thank you. It run now.

Good day.
Cool.
Could someone elaborate a bit on the reason that the proposed sollution works? Would be really helpful. I am confused because of the double list and the vector [2] which I cannot explain.

edit: well some thinking and a fresh cup of coffee made me realize that [2] is the allowed type String. Is it right that in this case the entry is converted to an unevaluated string because you specified that the allowed type is string?
Exactly, specifiying string means it will not evaluate anything. Storing into F1:="<string>" is a special case and will convert to an expression.
Reference URL's