HP Forums

Full Version: 50G variable issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hello all.

I'm having a devil of a time on this 50G with the simplest thing. So, I'd like some help. Thanks.

Why would this:

<< -> a b >> give me a 'Syntax Error' after I press ENTER as I just try to write this beginning steps of a program to see if I'm using the -> function correctly? Even when I try << -> 'a' 'b' >> , I get the same Syntax Error message.

Does my 50G need certain flags set? Are there certain libraries, functions or a reset/restore of the calc to its factory state that I need to perform?

As I've not programmed a 48GX in at least three years, I am quite a bit rusty.

<< -> A B << >> >>

The inner << >> are for the program to be written in.

Edited: 21 May 2012, 2:32 p.m.

Thanks! Relief!! Okay, so now the question is after local vars are created/consumed by the -> command, why must the next step always be << program >> instead of just coding the rest of the program even though the first set of << >> is already there?

You need the inner set of brackets to delineate the scope of the variables. There's nothing to prevent you from having more than one inner set.

-> a b
* do some stuff here to calculate two values
-> x y
* do some stuff with the two new values

You can also nest deeper.

-> a b
* do some stuff
-> x y
* do some stuff with a, b, x, and y
* do more stuff with a and b

Thanks for the refresher course. Yes, I could scope out one of those 'An Easy Course In...' but, since Educalc is now relegated to my MoHPC DVD, perhaps I could pour myself into the 28 manual as well as the myriad of 28 app packs there and learn by example. Would anyone here know where I could pick up some of those books so manufactured in the days of EduCalc and the 28 run?

By the way, has EduCalc resurfaced here on the web under another name perhaps? Could the EduCalc.net website be a remarketed/repackaged EduCalc or is it something different?


You can also use an algebraic expression directly after the local variable command, eg:
<< -> a b 'a^2+a*b+b^2' >>

Anyway, it's about the scope in which local variables exist. See the AUR chapter 1 section "Using Local Variables" (p1-7 i think).



Right, inner sub-program structure and local variables allow a lot of fun in RPL.

But the « -> a b « ... » » structure is not the only possible way.
One useful structure with local variable is the 'user function'. In contrary of program/sub-program structure, 'user function' permits algebraic or symbolic evaluations, derivations and integrations.
Simply replace the unique inner « ... » sub-program structure by an algebraic expression '...a...b...'

Having two types of local variables structures also explain a inner structure (program or algebraic object) is needed.

« -> a b 'a^2+a*b+b*b' »

P.S. Bart's message meets mine in the Internet Wires !

Edited: 21 May 2012, 3:14 p.m.

So, in all context, -> is more a local variable mechanism in contrast to a global variable creation mechanism.

And Bart, you are correct, indeed! Page 1-7 is EXACTLY where the dissertation on Local Variables begins! Well done!

Edited: 21 May 2012, 3:51 p.m.

Would anyone here know where I could pick up some of those books so manufactured in the days of EduCalc and the 28 run?

Try the "HP 48 Insights" books. They're right there on the MoHPC DVDs. I'm reading them now and find them very helpful.

For example, any variable that starts with a left arrow is automatically a local variable.

Also, executing a local variable always just returns it to the stack. If the variable contains a program that you wish to execute, you must add an EVAL instruction.