HP-48G local variables within subroutine
|
05-18-2023, 12:24 AM
Post: #9
|
|||
|
|||
RE: HP-48G local variables within subroutine
Hello,
@Boub65 If I understand you correctly, in your example a local variable named (e.g.) local_c could exist in the main program but also in a subroutine. ⇒ First possibility As 2old2randr explains, you can use nested code(s) in the main program kind. ⇒ 2nd possibility Now, you need to use the variable local_c in both a main program and one (or more) distinct subroutine(s); then local_c must be a compiled local variable. This is the only case where compiled local variables are needed. Their names begin always with a left arrow: ←local_c This type of variable did not exist on hp-28. It must have been created for the 48G/GX/G+ serie, if I'm not mistaken, and was kept for later RPL models. So, one example: Main program Code:
called_SUBR Code:
And don't forget that a variable, whether local or not, compiled or not, can contain any kind of object: numbers and strings of course, but also algebraic objects, lists, pieces of code (which can be, if needed, some kind of functions that you can carry anywhere in your application), the name of another variable... and even a directory. It's just a matter of need, taste and creativity. Best regards Bruno Sanyo CZ-0124 ⋅ TI-57 ⋅ HP-15C ⋅ Canon X-07 + XP-140 Monitor Card ⋅ HP-41CX ⋅ HP-28S ⋅ HP-50G ⋅ HP-50G |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP-48G local variables within subroutine - grbrum - 05-16-2023, 11:41 PM
RE: HP-48G local variables within subroutine - FLISZT - 05-17-2023, 01:58 AM
RE: HP-48G local variables within subroutine - Werner - 05-17-2023, 07:22 AM
RE: HP-48G local variables within subroutine - FLISZT - 05-17-2023, 07:51 AM
RE: HP-48G local variables within subroutine - grbrum - 05-17-2023, 03:21 AM
RE: HP-48G local variables within subroutine - FLISZT - 05-17-2023, 06:00 AM
RE: HP-48G local variables within subroutine - grbrum - 05-18-2023, 05:16 AM
RE: HP-48G local variables within subroutine - Boub65 - 05-17-2023, 02:09 PM
RE: HP-48G local variables within subroutine - 2old2randr - 05-17-2023, 10:33 PM
RE: HP-48G local variables within subroutine - BruceH - 05-18-2023, 09:12 PM
RE: HP-48G local variables within subroutine - FLISZT - 05-18-2023 12:24 AM
RE: HP-48G local variables within subroutine - Thomas Klemm - 05-19-2023, 04:00 PM
|
User(s) browsing this thread: 4 Guest(s)