Post Reply 
[VA] HP-71B Mini-challenge: Qualifying for a job
09-17-2022, 09:20 AM
Post: #20
RE: [VA] HP-71B Mini-challenge: Qualifying for a job
(09-17-2022 09:05 AM)ThomasF Wrote:  
Code:
0001 DEF FNZ @ DEF FNS(C) @ IF C>0 THEN FNS=FNS(C-1)+RND
0002 END @ DEF FNG=FNS(8)-4 @ DEF FNO=1 @ DEF FND=INT(RND*6)+1

0005 DEF FNG @ DEF FNT=5
0010 DISP TIME$ @ PAUSE

That worked fine, even when inserting line 5 and 10, sinced I expected the END at beginning of line 2 would act as a "DEF END", ie. executing "FNZ" will not display the time (only 0), but FNG sure will (show the time) but not FNT (will just show 5) ...

FNZ seems to work fine because you "opened" a multiline DEF structure on line 5. If you put any other code, or close your DEF FNG structure with END DEF followed by some code, that code will executed as part of the function FNZ.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] HP-71B Mini-challenge: Qualifying for a job - J-F Garnier - 09-17-2022 09:20 AM



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