Input syntax on the Prime



#2

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


#3

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


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

#4

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


#5

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.


#6

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

#7

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


#8

Thank's

Merci pour ces précisons !


Possibly Related Threads…
Thread Author Replies Views Last Post
  INPUT for HP Prime Eddie W. Shore 3 1,685 11-17-2013, 04:46 PM
Last Post: Michael de Estrada
  HP Prime Tutorial #4 is up (CASE/CHOOSE/INPUT) Eddie W. Shore 1 1,329 11-15-2013, 07:32 AM
Last Post: Davi Ribeiro de Oliveira
  hp prime - command syntax bluesun08 6 2,483 11-10-2013, 11:57 AM
Last Post: bluesun08
  HP Prime Programming Tutorial #3: WHILE, INPUT, KILL, REPEAT, GETKEY Eddie W. Shore 5 2,457 11-07-2013, 12:25 AM
Last Post: Han
  minor visual bug in INPUT Han 0 978 10-03-2013, 01:13 PM
Last Post: Han
  Input CAS var on HP Prime Mic 2 1,378 08-22-2013, 02:29 PM
Last Post: Mic
  HP 85 Serial Interface; INPUT Example? inaki 1 1,284 06-12-2013, 11:09 PM
Last Post: Paul Berger (Canada)
  HP33E how to input numbers RalfGeiger 6 2,084 05-07-2013, 02:41 PM
Last Post: Ron Ross
  HP 35s - multiple program input values? Arno 3 1,685 04-29-2013, 11:27 AM
Last Post: Gerson W. Barbosa
  HPIB Syntax Error at Status command inaki 3 2,334 04-06-2013, 07:57 PM
Last Post: Paul Berger (Canada)

Forum Jump: