Plus42 Equations, Preview Release
|
05-16-2022, 01:28 PM
(This post was last modified: 05-16-2022 01:32 PM by Eddie W. Shore.)
Post: #664
|
|||
|
|||
RE: Plus42 Equations, Preview Release
Love the Plus42 and all the enhancements.
I think I am getting how the FOR function works. Example: HP 39gII/Prime Code: A:=0; FOR K FROM 1 TO 4 DO (STEP 1) A:=A+K; END; Translate this to the Plus42: S=FOR(L(A:0):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I))) Result: S = 10 S=: set the result to the variable S INIT: L(A:0); set A = 0 COND: G(I)≤4; test if I≤4; if so continue, if not, end the loop NEXT: L(I:G(I)+1); this happens at the end of the loop, this is like the general STEP incr/decr command EXPR: L(A:G(A)+G(I)) The use of the Get function allows the variable to used automatically and not be displayed in the CALC menu. Something that threw me off is that the order of NEXT and EXPR, which the EXPR (which I think there could be more than one EXPR statements), I am used to NEXT either at the end of the FOR loop or implied (end of indentation in Python, for example). |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)