Post Reply 
define questions
06-21-2017, 12:31 PM
Post: #1
define questions
I'm gradually figuring out how to program the HP Prime. I'm not new to programming calculators and have 35 years experience as a software engineer, but I'm new to the HP prime. I keep running into CAS vs non-cas issues. Well I have a new one.
Before I describe this problem, let me say, yes, I know I can avoid using the define key altogether and create a program instead. I just want to know how to do it using the define key.
I have a program and I'm using 2 functions I programmed using the Define key. These are:
INC which is defined as X:=X+1;
INC2 which is defined as X:=X+2;

Now when I run my program it fails and when I debug it, it doesn't seem to increment my local variable n when I pass it in using INC(n);

So, I tried to run this from the CAS view using 0->a and then type INC(a), which gives me argument errors, so I try it from the home view.
Here, INC(a) shows 1, but when I run it again, it shows 1 again, instead of 2.
Then I tried INC2(a), and it shows 2, but when I try to run it again, it shows 2 again instead of 4. Why is this?
What am I missing?
It's starting to look to me like Defined functions are worthless. I thought they were similar to inline macros in C, rather than a compiled C function, which is what I'd see an EXPORTed function as being analogous to.
Help please?
Thanks in advance.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
define questions - webmasterpdx - 06-21-2017 12:31 PM
RE: define questions - Tim Wessman - 06-21-2017, 02:04 PM
RE: define questions - DrD - 06-21-2017, 02:14 PM
RE: define questions - webmasterpdx - 06-21-2017, 03:17 PM
RE: define questions - Didier Lachieze - 06-21-2017, 11:07 PM
RE: define questions - DrD - 06-21-2017, 09:19 PM
RE: define questions - AlexFekken - 06-22-2017, 02:12 AM
RE: define questions - webmasterpdx - 06-22-2017, 12:05 PM



User(s) browsing this thread: 1 Guest(s)