Variables in a Program(A,B)
|
05-15-2021, 08:35 PM
(This post was last modified: 05-15-2021 08:36 PM by matalog.)
Post: #1
|
|||
|
|||
Variables in a Program(A,B)
I have this program:
Code: EXPORT FT2M(A,B) What purpose do the variables in the name FT2M(A,B) serve? They do not seem to do anything apart from require the program to be called with: FT2M(A,B) or FT2M(2,4) e.g. Instead of just FT2M, which can be the case if I simply call the program FT2M(). Even when I enter numbers there, they have no reflection on the outcome of the program. |
|||
05-15-2021, 09:04 PM
(This post was last modified: 05-15-2021 09:09 PM by matalog.)
Post: #2
|
|||
|
|||
RE: Variables in a Program(A,B)
Okay, I get it now. Those variables will enter the program, but will remain as they were initially defined by the calling of the program in the program name, although A and B will be updated and used as required by the program.
I was redefining them within the program, and although it was not outputting them in the program name, they were being used as re-defined in the program. Now that I have removed the input lines, I understand the way it works. |
|||
05-16-2021, 05:33 AM
(This post was last modified: 05-16-2021 06:10 AM by C.Ret.)
Post: #3
|
|||
|
|||
RE: Variables in a Program(A,B)
Please also note that in your program, A et B are the only local variables, all the other affectations are modifying the contents of the global variables C, D and E. You have to use keyword LOCAL to design temporary variable only existing in the program environment.
Independently, concerning variables you have to daily use in different units, I greatly recommend you using the UNITS menu facilities of the HP Prime. The units of each value will be indicate in the stack avoiding a lot of mistake or worries ! To save variable with units, we have to use a different name than the reserve global variable names (the values with units can't be store in REAL or COMPLEX global variable slots). With the actual version of the software, it is easy to create user variable of versatile name, just touch (OK) when prompt for creating a new custom user variable name. Here is a short example of what can be done with custom user variable a and b of respective value 2_ft and 4_inch : [attachment=9475] As you can see, any result is indicated with the corresponding unit. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)