HP Forums
Input syntax on the Prime - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Input syntax on the Prime (/thread-248649.html)



Input syntax on the Prime - Gilles Carpentier - 08-22-2013

The input syntax of the prime allows to enter all types of datas (including quoted expression)and multiple items

here is an example :

EXPORT Inp
BEGIN
LOCAL m1,m2,s:="Enter the matrix using the [ ] key";
IF INPUT({m1,m2},"Multiply matrix",{"Enter m1","Enter m2"},{s,s}) THEN
m1*m2
ELSE
"Cancel"
END;
END;

Another example:

INPUT(F1,"Enter a function between ' '")

And you get the function F1 in the Apps 'function'

Rev 5106 needed. The syntax is describe in the integrated help.However i was unable to use the 'default value' parameters... Next rev ?

Only the first parameter is needed (variable or list of variables), all others are optional

Edited: 23 Aug 2013, 4:29 a.m. after one or more responses were posted


Re: Input syntax on the Prime - Mic - 08-22-2013

Ah stock the function var in F1, OK.
I had the 4980 rev...


Edited: 22 Aug 2013, 2:33 p.m.


Re: Input syntax on the Prime - Mic - 08-22-2013

I have an invalid error when I execute INPUT(F1);


Re: Input syntax on the Prime - Gilles Carpentier - 08-22-2013

I was perhaps 'brutal' here.

It seems to need that F1 is defined before because INPUT(VAR) recall the value of the VAR

LOCAL f;
BEGIN
INPUT (f);F1:=f;
...

seems better (not tested) and I've not verify in the APPS Function commands if there is something special (to check etc ...)

By the way, try INPUT M1 for example.

EDIT :just tested and seem OK

If you want "pseudo-typed" variable :

BEGIN
LOCAL a:=[[0,0],[0,0]];
INPUT(a);
END;

or

BEGIN
LOCAL a:="";
INPUT(a,"Enter your name");
END;

Edited: 22 Aug 2013, 3:33 p.m.


Re: Input syntax on the Prime - Mic - 08-22-2013

Yes, I used an intermediate var and it works : INPUT(f); f>F1;


Re: Input syntax on the Prime - cyrille de Br├ębisson - 08-23-2013

Hello

Quote:
Rev 5106 needed. The syntax is describe in the integrated help.However i was unable to use the 'default value' parameters... Next rev ?

help is incorrect, it's not the default, but the reset value...
default value (ie, value presented at opening of the input) is the value held in the varaible at the time INPUT is called.

reset value, a parameter specified in the INPUT command is used when you press backspace or CLEAR.

Cyrille


Re: Input syntax on the Prime - Gilles Carpentier - 08-23-2013

Thank's

Merci pour ces pr├ęcisons !