HP Forums
How the heck do I Iterate and Emulate? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: How the heck do I Iterate and Emulate? (/thread-4870.html)



How the heck do I Iterate and Emulate? - brickviking - 10-04-2015 07:18 AM

I've got a HP-50G, but people have been humming about the Prime for a little while now. I installed the emulator, and I have upgraded to the 8151 version. I tried a really simple program in the HP emulator:

Code:

EXPORT ITTST()
BEGIN
LOCAL X;
PRINT("X is "+X);
ITERATE(X^2,X,2,3);
PRINT("X is now "+X);
END;

All I get as output is "X is 0" (understandable) and "X is now 0" (which is not). Clearly I'm doing something completely wrong, as I typed the ITERATE example in from the manual, yet I'm not getting the same results as the manual. I also tried it in the Home screen, ITERATE worked fine there. So, where am I going wrong?

(Post 35)


RE: How the heck do I Iterate and Emulate? - Didier Lachieze - 10-04-2015 08:00 AM

ITERATE doesn't change the value of your local variable X.
You should do:
X:=ITERATE(X^2,X,2,3);


RE: How the heck do I Iterate and Emulate? - brickviking - 10-04-2015 09:23 AM

(10-04-2015 08:00 AM)Didier Lachieze Wrote:  ITERATE doesn't change the value of your local variable X.
You should do:
X:=ITERATE(X^2,X,2,3);

Ahh, that would explain that. So it's a bit more like PASCAL than I previously thought. Thank you.

(Post 36)