Post Reply 
New to RPL; Please critique this working sample. Thanks.
09-14-2016, 02:12 PM
Post: #3
RE: New to RPL; Please critique this working sample. Thanks.
(09-14-2016 05:56 AM)Nick Wrote:  I'm new to RPL. Please critique the following code...

There's a syntactical issue with your code pertaining to the use of locals, but in a more general sense, you may want to review this thread: Basic RPL question

There's a lot there, but it touches on several topics that are pertinent to your example.

Regarding the syntactical issues, you are actually creating two distinctly different copies of 'y' and 'm' in your code. Note that the "→" operator actually creates a local in addition to assigning its value. RPL lets you create multiple locals with the same name (which you almost never want to do), so you are effectively blocking access to the original ones in that last algebraic with the way you've written things. Local evaluation will return the most recently created instance when there's more than one with the same name. To assign values to preexisting locals, always use the '<varname>' STO syntax within their scope.

Speaking of scope, the best way to think of it in the context of locals is that the existence of a local is only defined for the immediately following object after local creation. That is why you have to group multiple RPL steps into a single code object with "<< ... >>" brackets to insure that they all can access the local. As you've discovered, nesting is allowed here. Just don't recreate more locals with the same name! Smile
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: New to RPL; Please critique this working sample. Thanks. - DavidM - 09-14-2016 02:12 PM

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